Moya Debug is a built in library that enables some debug only features. The primary feature is the error page that renders a Moya Traceback and error information.
Moya Debug is a built in library, and may be installed via its Python path as follows:
if=".debug" test ensures that Moya Debug is only imported when debug mode is enabled. Debug mode is enabled in settings as follows:
[project]debug = yes
production.ini will set
no to disable Moya Debug in a production environment.
priority="100" attribute ensures that templates in Moya Debug have the highest priority – in order to override any error handlers you have created.
You may install the library with the following line:
This mounts the debug views on
/debug/ (if the server is running in debug mode).
Moya Debug supplies handlers for 404 (not found) and 500 (internal error) pages by overriding the
500.html templates respectively.
The Not Found page will display information about the request, and the URL routes Moya ran through to attempt to generate a response. There are two possible scenarios that generate a 404 page; either there was no route matching the URL, or a route was found but your code intentionally returned a Not Found response. The Trace panel on the debug 404 page will tell you which was the case.
The Internal Error page will display information about the request, plus snapshot of the code being executed when the error occurred – which may be Moya code or template.
/debug/user/ whil show you information about the currently logged in user, including groups and permissions. You can also view the same information on other users by visiting
Moya Debug can display the code for any element – with syntax highlighting. Clicking a element reference in the 404 page will link to the debug view that displays code. For example,
Moya Debug can also display templates from the template filesystem. For example
/debug/templates/500.html would show you the template Moya Debug uses to render the Internal Error page.