Reputation: 459
The problem I'm having is that, when I comment out a urlpattern in my root urls.py file and restart the server (using fastCGI on Hostgator shared hosting) by killing the process and touching my index.fcgi file, I get a 404 error as expected (since the url is no longer matched), but when Django processes the 404.html template and sends returns it, its just the bare HTML with no static files or anything.
However, when I try any other URL but the ones that are matched by the urlpatterns I commented out (except ones that match a currently active pattern, of course), I get a fully rendered 404 page with all the proper CSS.
All of the static files are currently located in ~/public_html/, because that's apparently where the webserver (which I have no control over) looks for them.
I just can't figure out why Django (or the web server) would be able to find the static files in one case, but not in the other...
Thanks in advance for any ideas you all might have.
Upvotes: 1
Views: 259
Reputation: 8851
Just to make sure... you know that there are at least two different 404 pages, one that the webserver returns when the URL is not defined in the webserver config and second, the one that is returned by Django, when the webserver handed off the request to Django but the urls.py does not define a pattern matching the URL?
In case you are aware of that and the 404 pages with and without static content displayed in your browser are both served by Django, I would suggest to look at the requests the browser sends to get the static content. You can do that in the debug console of Chrome, Safari, Firefox. There you'd be able to see what's different with the requests (likely the URLs) so that the webserver is returning the static content for the one but not for the other case.
Upvotes: 2