KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I get Django 1.0 to write all errors to the console or a log file when running runserver in debug mode? I've tried using a middleware class with process_exception function as described in the accepted answer to this question: How do you log server errors on django sites The process_exception function is called for some exceptions (eg: assert(False) in views.py) but process_exception is not getting called for other errors like ImportErrors (eg: import thisclassdoesnotexist in urs.py). I'm new to Django/Python. Is this because of some distinction between run-time and compile-time errors? But then I would expect runserver to complain if it was a compile-time error and it doesn't. I've watched Simon Willison's fantastic presentation on Django debugging ( http://simonwillison.net/2008/May/22/debugging/ ) but I didn't see an option that would work well for me. In case it's relevant, I'm writing a Facebook app and Facebook masks HTTP 500 errors with their own message rather than showing Django's awesomely informative 500 page. So I need a way for all types of errors to be written to the console or file. Edit: I guess my expectation is that if Django can return a 500 error page with lots of detail when I have a bad import (ImportError) in urls.py, it should be able to write the same detail to the console or a file without having to add any additional exception handling to the code. I've never seen exception handling around import statements. Thanks, Jeff
Tags (comma-separated)
Save Edits
Cancel