From 0576e8ca5357fec5352203fdeb8297ace29cc987 Mon Sep 17 00:00:00 2001 From: Rushil Umaretiya <2023rumareti@tjhsst.edu> Date: Tue, 20 Oct 2020 04:40:53 -0400 Subject: [PATCH] added whitenoise support for staticfiles --- .gitignore | 4 +++- config/settings.py | 4 ++-- requirements.txt | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e4e9202..3d0395b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ -led / optimized / DLL files +#led / optimized / DLL files __pycache__/ *.py[cod] *$py.class secrets.py static_files .idea/ +.vscode/ # C extensions *.so @@ -64,6 +65,7 @@ local_settings.py db.sqlite3 db.sqlite3-journal + # Flask stuff: instance/ .webassets-cache diff --git a/config/settings.py b/config/settings.py index efc70d6..25d8ec0 100644 --- a/config/settings.py +++ b/config/settings.py @@ -45,6 +45,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -124,5 +125,4 @@ USE_TZ = True STATIC_URL = '/static/' import os -STATIC_ROOT = os.path.join(BASE_DIR, 'static_files') -STATICFILES_DIRS = [BASE_DIR / "static"] \ No newline at end of file +STATIC_ROOT = os.path.join(BASE_DIR, 'static') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 40ec83f..c408542 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,6 +10,7 @@ Django==3.1.2 django-extensions==3.0.9 django-secrets==1.0.2 future==0.18.2 +gunicorn==20.0.4 idna==2.10 notion==0.0.25 python-slugify==4.0.1 @@ -21,3 +22,4 @@ sqlparse==0.4.1 text-unidecode==1.3 tzlocal==2.1 urllib3==1.25.11 +whitenoise==5.2.0