Django Debugging Using "assert False"


While developing, inserting the following line to your code:

assert False, value

will cause django to raise an AssertionError with the value supplied as an error message when this line is executed.

If this occurs in a view, or in any code called from a view, and DEBUG=True is set, a full and detailed stacktrace with a lot of debugging information will be displayed in the browser.

Don't forget to remove the line when you are done!