I recently had a similar issue.
In development, the Django development server serves the static files as documented in the Django docs. If settings.DEBUG
is False
then static file serving by the development server stops. See this Stack Overflow post: Why does DEBUG=False setting make my django Static Files Access fail?
In addition to these configuration steps, you’ll also need to actually serve the static files.
During development, if you use django.contrib.staticfiles, this will be done automatically by runserver when DEBUG is set to True (see django.contrib.staticfiles.views.serve()).
This method is grossly inefficient and probably insecure, so it is unsuitable for production.
For production, there are options for serving static files as documented here.
I solved the issue of serving static files in production on an instance of Dokku—the smallest PaaS implementation you've ever seen—that is similar to Heroku.
I used a package called Whitenoise that is discussed in this blog post.
I found Whitenoise to be the easiest solution to serving static files for a small Django application without having to configure a separate static file server.