I had a similar problem in Heroku. It seems that Django cannot independently use static assets in production. I was able to use WhiteNoise to use statics instead. First install it:
$ pip install whitenoise
Make sure you add whitenoise to your requirements.txt .
Now add the following to wsgi.py :
from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise application = get_wsgi_application() application = DjangoWhiteNoise(application)
Finally, configure whitenoise in your settings.py:
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
or depending on which versions of Django and WhiteNoise you are using:
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
Also, make sure your stats are configured correctly in settings.py
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') STATIC_URL = '/static/' # Extra places for collectstatic to find static files. STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, 'static'), )
Additional information: https://devcenter.heroku.com/articles/django-assets
source share