diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..98c32e1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +src/celerybeat-schedule +src/.env.example +src/db.sqlite3 +config/db/databasepostgresql_env.example +**/__pycache__ \ No newline at end of file diff --git a/.gitignore b/.gitignore index d565dce..c3527c3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ db.sqlite3 src/config/settings/static .env Backup-codes-series.notification.txt -celerybeat-schedule \ No newline at end of file +celerybeat-schedule +databasepostgresql_env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..51b2e83 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code +COPY requirements.txt /code/ +RUN pip install -r requirements.txt +COPY src /code/src/ +COPY config /code/config/ \ No newline at end of file diff --git a/config/db/databasepostgresql_env.example b/config/db/databasepostgresql_env.example new file mode 100644 index 0000000..0892687 --- /dev/null +++ b/config/db/databasepostgresql_env.example @@ -0,0 +1,3 @@ +POSTGRES_USER= +POSTGRES_PASSWORD= +POSTGRES_DB= \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b49e283 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.9" + +services: + db: + image: postgres + volumes: + - dbdata:/var/lib/postgresql/data + env_file: + - config/db/databasepostgresql_env + + django: + build: . + command: python3 src/manage.py runserver 0.0.0.0:8000 --settings=config.settings.production + ports: + - "8000:8000" + depends_on: + - db + +volumes: + dbdata: \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 87c6cdb..db7e87c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,11 +15,12 @@ django-autoslug==1.9.8 django-compat==1.0.15 django-crispy-forms==1.14.0 django-environ==0.9.0 -django-smtp-ssl +django-smtp-ssl==1.0 idna==3.3 kombu==5.2.4 packaging==21.3 prompt-toolkit==3.0.31 +psycopg2==2.9.3 pyparsing==3.0.9 pytz==2022.2.1 redis==4.3.4 diff --git a/src/config/settings/production.py b/src/config/settings/production.py index 7891241..458f264 100644 --- a/src/config/settings/production.py +++ b/src/config/settings/production.py @@ -3,7 +3,7 @@ from .base import * DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] DATABASES = { 'default': { @@ -11,10 +11,12 @@ DATABASES = { 'NAME': env('DB_NAME'), 'USER': env('DB_USER'), 'PASSWORD': env('DB_PASSWORD'), - 'HOST': 'databasepostgresql', + 'HOST': 'db', 'PORT': '5432', } } -STATIC_URL = '/django_static/' -STATIC_ROOT = os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), 'opt/services/djangoapp/django_static') \ No newline at end of file +STATIC_URL = '/static/' +STATICFILES_DIRS = [ + BASE_DIR / 'static' +] \ No newline at end of file