From dc79c87045474066128733e03c5e7e70a5d508dd Mon Sep 17 00:00:00 2001 From: Bobby Date: Mon, 18 Jul 2022 11:45:40 +0530 Subject: Added whitenoise --- Dockerfile | 6 ++---- requirements.txt | 1 + thatcomputerscientist/settings.py | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ed09417..3c91da9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,12 +17,10 @@ RUN pip install -r requirements.txt COPY . . -# RUN python manage.py collectstatic --noinput +RUN python manage.py collectstatic --noinput EXPOSE 8080 # replace APP_NAME with module name -# CMD ["gunicorn", "--bind", ":8080", "--workers", "2", "thatcomputerscientist.wsgi"] -CMD ["python3", "manage.py", "runserver", "8080"] - +CMD ["gunicorn", "--bind", ":8080", "--workers", "2", "thatcomputerscientist.wsgi"] diff --git a/requirements.txt b/requirements.txt index c470db6a..ee3b114b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ Django==4.0.6 python-dotenv==0.20.0 mysqlclient==2.1.1 gunicorn==20.1.0 +whitenoise=6.2.0 diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py index 9d788d5e..168e0239 100644 --- a/thatcomputerscientist/settings.py +++ b/thatcomputerscientist/settings.py @@ -51,6 +51,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', ] ROOT_URLCONF = 'thatcomputerscientist.urls' @@ -134,4 +135,4 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_ROOT = BASE_DIR / "staticfiles" -- cgit v1.2.3