diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f2d46d5671247ec17c06fe3957c1579c20c33f3b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# pull official base image +FROM python:3.8.0 + +# set work directory +WORKDIR /usr/src/app + +# set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# install dependencies +RUN apt-get -y update +RUN apt-get install -y python python-pip python-dev python-django-extensions +RUN pip install --upgrade pip +COPY ./requirements/development.txt /usr/src/app/requirements.txt +RUN pip install -r requirements.txt + +RUN apt-get -y update && apt-get -y autoremove + +# copy project +COPY ./src /usr/src/app/ \ No newline at end of file diff --git a/requirements/development.in b/requirements/development.in index 0ca557c5220fc15f49f9a43b543f6ba40790393d..e38b674d74cb67176ffb618495ac46e4efe7bd52 100644 --- a/requirements/development.in +++ b/requirements/development.in @@ -5,4 +5,4 @@ django-extensions==2.2.1 python-language-server==0.28.2 drf-yasg==1.16.1 packaging==19.1 -Pillow \ No newline at end of file +Pillow==7.0.0 \ No newline at end of file diff --git a/requirements/production.in b/requirements/production.in index 725c782c07dd287d562a71406cb044b76be4426b..71c15873ba4e2b7f68f65a9c74e441c669985d70 100644 --- a/requirements/production.in +++ b/requirements/production.in @@ -1,3 +1,10 @@ -r base.in +psycopg2-binary gunicorn==19.7.1 -Pillow +flake8==3.7.8 +pip-tools==4.1.0 +django-extensions==2.2.1 +python-language-server==0.28.2 +drf-yasg==1.16.1 +packaging==19.1 +Pillow==7.0.0 diff --git a/src/kszkepzes/settings/base.py b/src/kszkepzes/settings/base.py index 5fdbd69e6fe8a3b0ec1ecd0e49c618c354d97836..79bb0903c49615ad0c6a96a2f6c50fa293b98215 100644 --- a/src/kszkepzes/settings/base.py +++ b/src/kszkepzes/settings/base.py @@ -156,7 +156,8 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ -STATIC_URL = '/django-static/' +STATIC_URL = '/staticfiles/' +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") -MEDIA_ROOT = os.getenv('MEDIA_ROOT', '/tmp') -MEDIA_URL = '/media/' +MEDIA_URL = "/mediafiles/" +MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles") diff --git a/src/kszkepzes/settings/local.py b/src/kszkepzes/settings/local.py index caa2719d4630ba660fb7e1709250b5530173749b..1c4e0b5cb5ea38e79c195fc5e345f921fb5a8849 100644 --- a/src/kszkepzes/settings/local.py +++ b/src/kszkepzes/settings/local.py @@ -1,5 +1,7 @@ from .base import * +DEBUG = int(os.environ.get("DEBUG", default=1)) + SESSION_COOKIE_SECURE = False EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' diff --git a/src/kszkepzes/settings/production.py b/src/kszkepzes/settings/production.py index cbd865978fa81069cdf9c99a29f8360375bb6fd2..7c121b50db4caa8c0c3823507663e1dc3aadf673 100644 --- a/src/kszkepzes/settings/production.py +++ b/src/kszkepzes/settings/production.py @@ -1,6 +1,6 @@ from .base import * -DEBUG = False +DEBUG = int(os.environ.get("DEBUG", default=0)) ALLOWED_HOSTS = ['*']