Reputation: 18554
I have a custom Django 500 page and debug set to False. When my app encounters a runtime error, I get the Django stack trace as expected.
However when I have a syntax error, I get the cryptic Apache "Internal Server Error" page, and have to debug Django by tailing the apache log.
Why doesn't Django show the error page?
I believe I used to get Django error pages for all errors - not just runtime ones.
Any help would be greatly appreciated.
Upvotes: 1
Views: 347
Reputation: 39578
It's because the interpreter running django (started by apache) won't even start, so there is no way to render the actual page.
What goes into apache log is the python interpreter's stderr
When using mod_wsgi, unless you or the web framework you are using takes specific action to catch exceptions and present the details in an alternate manner, the only place that details of uncaught exceptions will be recorded is in the Apache error log files. The Apache error log files are therefore your prime source of information when things go wrong.
To summarize: The SyntaxError
means that the code is not python so there is no one to catch the exception and show it in a friendly web page.
I don't know to how to change this in Apache, but at least in my tests running green unicorn + nginx I do get stacktraces on the 500 page if I run my green unicorn workers with --debug
- even when Django fails to load because of the SyntaxError
Upvotes: 3