What’s the best method to debug Django’s url configurations? Sometime it just throw out a Unhandled Exception without any hints if there is an error in urls.py
Sometimes it throws out errors like “unbalanced parenthesis” but I still dont know which line in urls.py caused the error.
For underlying application errors, I sometimes find it helpful to toggle the value of
TEMPLATE_DEBUGinsettings.py(django docs here). Often this gives me the backtrace I need to spot syntax errors outside the template, or other bone-headed code that I might have botched.If that fails, try importing your view module from the django shell:
If there’s truly a syntax error, this will bomb in the import and expose the offending line immediately.