I just set up my django in a production environment with Apache and mod_wsgi. Everything seems to be working great. I’ve granted access to the static folder (for admin resources) and the server is working just as expecting.
There just seems to be one weird thing when trying to view web pages that don’t match a URL through Django. When this apparent 404 is reached (I have DEBUG turned on for the moment).
This problem stems from my desire to disable directory listing within the static folder.
I added the Options -Indexes argument and it seems to have worked.
The only issue is that the apache rewrite engine seems to, when it cannot find the resource (or the resource is a folder) it appends 404.shtml to the URL. But append isn’t quite the right word. Instead, it replaces the last 9 characters of the request URL with 404.shtml. Then my Django 404 debug screen comes up and there’s a nonsensical version of my original request.
Here’s an example:
Request URL:
http://mobile.mywebsite.com/static/unknown_file
Django receives:
Page not found (404)
Request Method: GET
Request URL: http://mobile.mywebsite.com/static/un/404.shtml
However, if instead I request
http://mobile.mywebsite.com/static/404.shtml
Then it gets overwritten with the same text, so http://mobile.mywebsite.com/static/404.shtml appears, apparently unchanged.
Any ideas?
It sounds like you have custom http document defined in your apache configuration, i.e. something like: