Serve production static files with Django.
This is a modification of the original dj-static by Kenneth Reitz (https://pypi.python.org/pypi/dj-static)
This is a simple Django middleware utility that allows you to properly serve static assets from production with a WSGI server like Gunicorn.
It is suitable for the production use of static file serving, unlike Django.
Configure your static assets in settings.py:
STATIC_ROOT = 'staticfiles' STATIC_URL = '/static/'
Then, update your wsgi.py file to use dj-static:
from django.core.wsgi import get_wsgi_application from dj_static import Cling application = Cling(get_wsgi_application())
from django.core.wsgi import get_wsgi_application from dj_static import Cling import static class BaseCling(static.Cling): ... application = Cling(get_wsgi_application(), cling_class=BaseCling)