• 5.0
  • dev
  • Documentation version:4.2

Writing your first Django app, part 8

This tutorial begins whereTutorial 7 left off. We’vebuilt our web-poll application and will now look at third-party packages. One ofDjango’s strengths is the rich ecosystem of third-party packages. They’recommunity developed packages that can be used to quickly improve the feature setof an application.

This tutorial will show how to addDjango Debug Toolbar, a commonly used third-partypackage. The Django Debug Toolbar has ranked in the top three most usedthird-party packages in the Django Developers Survey in recent years.

Where to get help:

If you’re having trouble going through this tutorial, please head over totheGetting Help section of the FAQ.

Installing Django Debug Toolbar

Django Debug Toolbar is a useful tool for debugging Django web applications.It’s a third-party package maintained by theJazzband organization. The toolbar helps you understand how yourapplication functions and to identify problems. It does so by providing panelsthat provide debug information about the current request and response.

To install a third-party application like the toolbar, you need to installthe package by running the below command within an activated virtualenvironment. This is similar to our earlier step toinstall Django.

$python -m pip install django-debug-toolbar
...\> py -m pip install django-debug-toolbar

Third-party packages that integrate with Django need some post-installationsetup to integrate them with your project. Often you will need to add thepackage’s Django app to yourINSTALLED_APPS setting. Some packagesneed other changes, like additions to your URLconf (urls.py).

Django Debug Toolbar requires several setup steps. Follow them initsinstallation guide.The steps are not duplicated in this tutorial, because as a third-partypackage, it may change separately to Django’s schedule.

Once installed, you should be able to see the DjDT “handle” on the right sideof the browser window when you refresh the polls application. Click it to openthe debug toolbar and use the tools in each panel. See thepanelsdocumentation page for moreinformation on what the panels show.

Getting help from others

At some point you will run into a problem, for example thetoolbar may not render. When this happens and you’re unable toresolve the issue yourself, there are options available to you.

  1. If the problem is with a specific package, check if there’s atroubleshooting of FAQ in the package’s documentation. For example theDjango Debug Toolbar has aTips section thatoutlines troubleshooting options.
  2. Search for similar issues on the package’s issue tracker. Django DebugToolbar’s ison GitHub.
  3. Consult theDjango Forum.
  4. Join theDjango Discord server.
  5. Join the #Django IRC channel onLibera.chat.

Installing other third-party packages

There are many more third-party packages, which you can find using thefantastic Django resource,Django Packages.

It can be difficult to know what third-party packages you should use. Thisdepends on your needs and goals. Sometimes it’s fine to use a package that’sin its alpha state. Other times, you need to know it’s production ready.Adam Johnson has a blog post that outlinesa set of characteristics that qualifies a package as “well maintained”.Django Packages shows data for some of these characteristics, such as when thepackage was last updated.

As Adam points out in his post, when the answer to one of the questions is“no”, that’s an opportunity to contribute.

What’s next?

The beginner tutorial ends here. In the meantime, you might want to check outsome pointers onwhere to go from here.

If you are familiar with Python packaging and interested in learning how toturn polls into a “reusable app”, check outAdvanced tutorial: How towrite reusable apps.

Writing your first Django app, part 7
Advanced tutorial: How to write reusable apps
Back to Top