Django Flatpages with Debug Set to False
After deploying a site I am working on to a preview server running apache/mod_python, it was the first time serving up the site in something other than python manage.py runserver.
I worked through a number of issues that I found quick answers for on the FAQ site for django, but one in particular I couldn't figure out, but eventually got pointed to the obvious in the irc channel for django.
The site has a number of flatpages, which I have come to learn is a middleware trick where when a url doesn't match anything and right before a 404 normally would be thrown giving the Page Not Found error, it checks against any flatpage "urls" you have registered the database with static content. If it finds something it will return that content, if not the 404 bubbles back out of the middleware and goes to the user.
Everything worked fine with DEBUG=True in my settings.py file. However, when I changed it to DEBUG=False, I got a 500 Internal Server Error but then when I looked at my error.log, I could see a django exception saying it couldn't find the 404.html.
This made no sense to me at all. Why would it be looking for a 404.html when it doesn't need it yet (the flatpage middleware should have intercepted it before it looked for a 404.html template, was my thinking). It was suggested to me in the irc channel that I create a 404.html (for more reasons that just fixing this problem).
So to just test that theory, I ran touch templates/404.html -- it worked!
Commentary
I was having this same problem. Thanks for the info.
This is great to know. It's just another thing that would be good to include in a default file structure.
More thought on the subject of defaults here: http://jeffcroft.com/links/2008/aug/14/django-filedirectory-name-conventions/ here: http://jeffcroft.com/links/2008/aug/14/django-filedirectory-name-conventions/ and here: http://blog.michaeltrier.com/2007/12/18/a-kinder-gentler-django
Thank you for the tip. You would think this would be fixed by now or recommended in the docs.
Thanks for the hint! I stumbled over the same problem.
Thank you! Got the exact same problem, worked with your tip!