├── .env ├── .gitignore ├── Dockerfile ├── README.md ├── docker-compose.yml ├── entrypoint.sh ├── index ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── __init__.cpython-38.pyc │ ├── admin.cpython-310.pyc │ ├── admin.cpython-38.pyc │ ├── apps.cpython-38.pyc │ ├── models.cpython-310.pyc │ ├── models.cpython-38.pyc │ ├── urls.cpython-310.pyc │ ├── urls.cpython-38.pyc │ ├── views.cpython-310.pyc │ └── views.cpython-38.pyc ├── admin.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-310.pyc │ │ ├── 0001_initial.cpython-38.pyc │ │ ├── __init__.cpython-310.pyc │ │ └── __init__.cpython-38.pyc ├── models.py ├── tests.py ├── urls.py └── views.py ├── manage.py ├── notes.txt ├── project ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── __init__.cpython-38.pyc │ ├── settings.cpython-310.pyc │ ├── settings.cpython-38.pyc │ ├── urls.cpython-310.pyc │ ├── urls.cpython-38.pyc │ ├── wsgi.cpython-310.pyc │ └── wsgi.cpython-38.pyc ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── requirements.txt └── templates └── index.html /.env: -------------------------------------------------------------------------------- 1 | POSTGRES_DB=mydb 2 | POSTGRES_USER=myuser 3 | POSTGRES_PASSWORD=mypassword 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /media_cdn 2 | /static_cdn 3 | .env 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.8 3 | 4 | # Set environment variables 5 | ENV PYTHONUNBUFFERED 1 6 | #This means that as soon as a message is generated (e.g., by a print statement), it's immediately visible, making it easier to see real-time output and diagnose issues more quickly, especially in environments like Docker where log messages may be crucial for debugging. 7 | ENV DJANGO_SETTINGS_MODULE project.settings 8 | 9 | # Create and set the working directory 10 | RUN mkdir /code 11 | WORKDIR /code 12 | 13 | # Copy the current directory contents into the container at /code 14 | COPY . /code/ 15 | 16 | # Install any needed packages specified in requirements.txt 17 | RUN pip install -r requirements.txt 18 | 19 | # Copy the entrypoint script and make it executable 20 | COPY entrypoint.sh /code/entrypoint.sh 21 | RUN chmod +x /code/entrypoint.sh 22 | # Copy the entrypoint.sh script and set execute permissions 23 | 24 | # Expose the port the application runs on 25 | EXPOSE 8000 26 | 27 | 28 | # Run Django development server 29 | CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] 30 | 31 | #In summary, EXPOSE is used within the Dockerfile to document which ports a container might use, 32 | #while port binding with -p or -P is used at runtime to actually open and map ports between the host and the container, making container services accessible from the host or external network. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Django Docker Project 2 | 3 | This is a sample Django project that has been containerized using Docker. It provides a basic structure to help you get started with running your Django application in a Docker container. 4 | 5 | ## Prerequisites 6 | 7 | Before you get started, make sure you have the following tools installed on your system: 8 | 9 | - [Docker](https://docs.docker.com/get-docker/) 10 | - [Docker Compose](https://docs.docker.com/compose/install/) (typically included with Docker for desktop systems) 11 | 12 | ## Getting Started 13 | 14 | Follow these steps to set up and run your Django project using Docker: 15 | 16 | 1. Clone this repository to your local machine: 17 | 18 | ```bash 19 | git clone https://github.com/budescode/django-docker.git 20 | cd project 21 | 22 | 2. Create an .env file in the project and paste the env variables for the databse: 23 | 24 | ```bash 25 | POSTGRES_DB=mydb 26 | POSTGRES_USER=myuser 27 | POSTGRES_PASSWORD=mypassword 28 | 29 | 3. Build and start the Docker containers: 30 | 31 | ```bash 32 | docker-compose up --build 33 | 34 | 4. Your Django application should now be running in a Docker container. You can access it in your web browser at 35 | ```bash 36 | http://localhost:8000. 37 | 38 | 39 | 5. To stop the containers, run: 40 | 41 | ```bash 42 | docker-compose down 43 | 44 | ## Project Structure 45 | 46 | The project structure follows a typical Django layout, with a few additional files and directories for Docker containerization: 47 | 48 | Dockerfile: Specifies the instructions for building the Django application container. 49 | docker-compose.yml: Defines the services (containers) required for the application, including the web server and database. 50 | requirements.txt: Lists the Python packages and dependencies required for the Django application. 51 | .env: Configuration file for environment variables. 52 | static/: Static files for your project (CSS, JavaScript, etc.). 53 | media_cdn/: Media files (user uploads, images, etc.). 54 | templates/: HTML templates for rendering views. 55 | 56 | ## Customization 57 | You can customize this project by: 58 | 59 | Modifying the Django application. 60 | Adjusting the Docker configuration in the Dockerfile and docker-compose.yml to suit your needs. 61 | Adding additional Django apps, models, and views as per your project requirements. 62 | 63 | ## Contributions 64 | If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request. 65 | 66 | License 67 | This project is licensed under the MIT License. Feel free to use and modify it for your needs. 68 | 69 | Happy coding! 70 | 71 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | # Django web application 5 | web: 6 | container_name: my-django-app 7 | build: 8 | context: . 9 | dockerfile: Dockerfile 10 | env_file: 11 | - .env 12 | ports: 13 | - "8000:8000" 14 | volumes: 15 | - .:/code 16 | depends_on: 17 | - db 18 | environment: 19 | - DEBUG=True # Set your Django application environment variables here 20 | command: sh ./entrypoint.sh 21 | 22 | # PostgreSQL database 23 | db: 24 | image: postgres:14.1-alpine 25 | container_name: my-postgres-db 26 | volumes: 27 | - postgres_data:/var/lib/postgresql/data 28 | ports: 29 | - "5432:5432" 30 | env_file: 31 | - .env # Include the environment file here 32 | 33 | volumes: 34 | postgres_data: 35 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | python3 manage.py migrate --no-input 4 | python3 manage.py collectstatic --no-input 5 | python manage.py runserver 0.0.0.0:8000 6 | -------------------------------------------------------------------------------- /index/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__init__.py -------------------------------------------------------------------------------- /index/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /index/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /index/__pycache__/admin.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/admin.cpython-310.pyc -------------------------------------------------------------------------------- /index/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /index/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /index/__pycache__/models.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/models.cpython-310.pyc -------------------------------------------------------------------------------- /index/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /index/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /index/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /index/__pycache__/views.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/views.cpython-310.pyc -------------------------------------------------------------------------------- /index/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /index/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Book 4 | admin.site.register(Book) -------------------------------------------------------------------------------- /index/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class IndexConfig(AppConfig): 5 | name = 'index' 6 | -------------------------------------------------------------------------------- /index/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0 on 2023-11-06 20:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Book', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=50)), 19 | ('author', models.CharField(max_length=50)), 20 | ('description', models.TextField()), 21 | ('image', models.ImageField(upload_to='')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /index/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/migrations/__init__.py -------------------------------------------------------------------------------- /index/migrations/__pycache__/0001_initial.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/migrations/__pycache__/0001_initial.cpython-310.pyc -------------------------------------------------------------------------------- /index/migrations/__pycache__/0001_initial.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/migrations/__pycache__/0001_initial.cpython-38.pyc -------------------------------------------------------------------------------- /index/migrations/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/migrations/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /index/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/index/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /index/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class Book(models.Model): 4 | name = models.CharField(max_length=50) 5 | author = models.CharField(max_length=50) 6 | description = models.TextField() 7 | image = models.ImageField() -------------------------------------------------------------------------------- /index/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /index/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import indexView 3 | 4 | urlpatterns = [ 5 | 6 | path('', indexView), 7 | ] -------------------------------------------------------------------------------- /index/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | def indexView(request): 4 | return render(request, 'index.html') -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /notes.txt: -------------------------------------------------------------------------------- 1 | docker-compose exec web /bin/sh 2 | ###enter a service terminal 3 | 4 | 5 | docker-compose run web python3 manage.py migrate 6 | to run a command in a service -------------------------------------------------------------------------------- /project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__init__.py -------------------------------------------------------------------------------- /project/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /project/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /project/__pycache__/settings.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/settings.cpython-310.pyc -------------------------------------------------------------------------------- /project/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /project/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /project/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /project/__pycache__/wsgi.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/wsgi.cpython-310.pyc -------------------------------------------------------------------------------- /project/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budescode/django-docker/74c292973529e3bf5432e769854ee76afcdf2bd5/project/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for project project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /project/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for project project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'unb1m%jfh^3zb^5x&jweq$-^dfi1_3m_sze%80osq0xu+c@b@!' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = ['0.0.0.0'] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'index' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'project.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'project.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 76 | 77 | # DATABASES = { 78 | # 'default': { 79 | # 'ENGINE': 'django.db.backends.sqlite3', 80 | # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | # } 82 | # } 83 | 84 | DATABASES = { 85 | 'default': { 86 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 87 | 'NAME': os.environ.get('POSTGRES_DB'), 88 | 'USER': os.environ.get('POSTGRES_USER'), 89 | 'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), 90 | 'HOST': os.environ.get('POSTGRES_HOST', 'db'), 91 | 'HOST': 'db', 92 | 'PORT': 5432, 93 | } 94 | } 95 | 96 | 97 | # Password validation 98 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 99 | 100 | AUTH_PASSWORD_VALIDATORS = [ 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 103 | }, 104 | { 105 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 106 | }, 107 | { 108 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 109 | }, 110 | { 111 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 112 | }, 113 | ] 114 | 115 | 116 | # Internationalization 117 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 118 | 119 | LANGUAGE_CODE = 'en-us' 120 | 121 | TIME_ZONE = 'UTC' 122 | 123 | USE_I18N = True 124 | 125 | USE_L10N = True 126 | 127 | USE_TZ = True 128 | 129 | 130 | # Static files (CSS, JavaScript, Images) 131 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 132 | 133 | STATIC_URL = '/static/' 134 | STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static')] 135 | STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn') 136 | MEDIA_URL = '/media_cdn/' 137 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media_cdn') -------------------------------------------------------------------------------- /project/urls.py: -------------------------------------------------------------------------------- 1 | """project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('', include('index.urls')), 24 | ] 25 | 26 | if settings.DEBUG: 27 | urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 28 | urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 29 | -------------------------------------------------------------------------------- /project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for project project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.6.0 2 | certifi==2022.12.7 3 | charset-normalizer==3.1.0 4 | Django==4.0.0 5 | django-js-asset==2.0.0 6 | idna==3.4 7 | Pillow==9.1.1 8 | psycopg2==2.9.3 9 | psycopg2-binary==2.9.3 10 | pytz==2022.7.1 11 | requests==2.28.2 12 | sqlparse==0.4.3 13 | urllib3==1.26.15 14 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

--------------------------------------------------------------------------------