collectstatic cmd added to Dockerfile build, despite no static files yet being part of project; static dir added to .gitignore; if/else clause added to core.settings to handle debug, secret key & allowed host values when debug is true & otherwise

This commit is contained in:
Disco DeDisco
2026-01-05 00:32:41 -05:00
parent 1cc3141186
commit 18d28600c9
3 changed files with 15 additions and 5 deletions

1
.gitignore vendored
View File

@@ -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.

View File

@@ -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"]

View File

@@ -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