How To Debug in Django. Useful Tips

Last updated 1 year ago by Be Django

django

Many people think that throughout our professional career, developers spend most of their time troubleshooting bugs in applications that we implement or reverse engineer, so one of our biggest allies should be debuggers. From BeDjango we will discuss a series of methods and utilities, some very simple and others more complex, to help you in your Django projects, although some of the following tools can be used without problemseasily in any Python project. Logging

The first and perhaps the best known tool, is to configure a good logging system in our application, which allows us to detect errors and even register actions that we want to monitor. Django is based on the package logging of the standard Python library and the configuration is very simple, permitting a default logging in our Django projects. In any case, if you want to configure a logging for the first time you want to do so and we encourage you to do so. Out of interest here are the different levels of messages that we can control:

  • DEBUG: Low level system information for debugging purposes
  • INFO: General system information
  • WARNING: Information describing a minor problem that has occurred
  • ERROR: Information describing a major problem that has occurred
  • CRITICAL: Information describing a critical problem that has occurred
Read full Article