a6f865a82b4d — Joe Ulfers 1.0.4 6 years ago
Use Whitenoise 4 configuration
3 files changed, 6 insertions(+), 4 deletions(-)

M readme.md
M settings.py
M wsgi.py
M readme.md +3 -2
@@ 9,8 9,9 @@ Qwerty War is a JavaScript typing game i
     sudo -H pip3 install virtualenv
     virtualenv venv
     source venv/bin/activate
-    # for dev, only needs django, the other dependencies in requirements.txt are for Heroku
-    pip install django 
+    # for dev, only really needs django and whitenoise, the other
+    # dependencies in requirements.txt are for Heroku
+    pip install -r requirements.txt 
     export DJANGO_DEBUG=1 # development only, used in settings.py
     ./manage.py runserver
 

          
M settings.py +2 -0
@@ 30,6 30,7 @@ MIDDLEWARE = [
     'django.middleware.common.CommonMiddleware', # for append slash and prepend www
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
+    'whitenoise.middleware.WhiteNoiseMiddleware',
 ]
 
 ROOT_URLCONF = 'qwertywar.urls'

          
@@ 42,6 43,7 @@ TEMPLATES = [{
 STATIC_URL = '/static/'
 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
 STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, 'static')]
+STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
 
 TIME_ZONE = 'UTC'
 USE_TZ = True

          
M wsgi.py +1 -2
@@ 2,5 2,4 @@ import os
 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
 
 from django.core.wsgi import get_wsgi_application
-from whitenoise.django import DjangoWhiteNoise
-application = DjangoWhiteNoise(get_wsgi_application())
+application = get_wsgi_application()