diff --git a/.gitignore b/.gitignore index c1f993a..4deff16 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ local_settings.py db.sqlite3 db.sqlite3-journal media +static # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ # in your Git repository. Update and uncomment the following line accordingly. diff --git a/Dockerfile b/Dockerfile index 59014e1..252091a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,8 @@ COPY src /src WORKDIR /src +RUN python manage.py collectstatic + +ENV DJANGO_DEBUG_FALSE=1 + CMD ["gunicorn", "--bind", ":8888", "core.wsgi:application"] \ No newline at end of file diff --git a/src/core/settings.py b/src/core/settings.py index 0d23e0e..127960d 100644 --- a/src/core/settings.py +++ b/src/core/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/6.0/ref/settings/ """ from pathlib import Path +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -19,13 +20,17 @@ BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/ -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-&9b_h=qpjy=sshhnsyg98&jp7(t6*v78__y%h2l$b#_@6z$-9r' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] +if 'DJANGO_DEBUG_FALSE' in os.environ: + DEBUG = False + SECRET_KEY = os.environ['DJANGO_SECRET_KEY'] + ALLOWED_HOSTS = [os.environ["DJANGO_ALLOWED_HOST"]] +else: + DEBUG = True + # SECURITY WARNING: keep the secret key used in production secret! + SECRET_KEY = 'django-insecure-&9b_h=qpjy=sshhnsyg98&jp7(t6*v78__y%h2l$b#_@6z$-9r' + ALLOWED_HOSTS = [] # Application definition