Reputation: 50372
I'm having trouble serving static files through my web server running mod_wsgi and dJango. Our server provider is Heroku.
Because the files are static, and should not be evaluated, I've heard that they should be served directly instead of going through mod_wsgi instead and dJango should not touch them?
I feel like this should be a simple thing, but I'm struggling with it. I'd really appreciate it if anyone could point me in the right directing as to how I should be attempting to store and serve static files?
Upvotes: 0
Views: 257
Reputation: 33670
The idea is to use the Web server to handle requests for static files and not pass those through to your Django instance. The reason for that is that Web servers, unlike your Django application, are optimized for delivering static content.
The only thing you really need to do is configure your Web server to handle requests that match the path of your STATIC_URL
and MEDIA_URL
by setting the document root for those requests to the location where your static and media files are stored by your application.
Upvotes: 1