Parcourir la source

tweak settings/wsgi to use whitenoise for heroku

David Ray il y a 8 ans
Parent
commit
4a73f34bce
2 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 3 4
      bakerydemo/heroku_wsgi.py
  2. 5 0
      bakerydemo/settings/heroku.py

+ 3 - 4
bakerydemo/heroku_wsgi.py

@@ -1,6 +1,5 @@
+from django.core.wsgi import get_wsgi_application
 from whitenoise.django import DjangoWhiteNoise
 
-from .wsgi import application as _application
-
-
-application = DjangoWhiteNoise(_application)
+application = get_wsgi_application()
+application = DjangoWhiteNoise(application)

+ 5 - 0
bakerydemo/settings/heroku.py

@@ -18,6 +18,11 @@ BASE_URL = 'http://localhost:8000'
 db_from_env = dj_database_url.config(conn_max_age=500)
 DATABASES['default'].update(db_from_env)
 
+# Simplified static file serving.
+# https://warehouse.python.org/project/whitenoise/
+
+STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
+
 try:
     from .local import *
 except ImportError: