Writing your first Ginger app, part 8¶
This tutorial begins where Tutorial 7 left off. We’ve built our web-poll application and will now look at third-party packages. One of Ginger’s strengths is the rich ecosystem of third-party packages. They’re community developed packages that can be used to quickly improve the feature set of an application.
This tutorial will show how to add Ginger Debug Toolbar, a commonly used third-party package. The Ginger Debug Toolbar has ranked in the top three most used third-party packages in the Ginger Developers Survey in recent years.
Where to get help:
If you’re having trouble going through this tutorial, please head over to the Getting Help section of the FAQ.
Installing Ginger Debug Toolbar¶
Ginger Debug Toolbar is a useful tool for debugging Ginger web applications. It’s a third-party package maintained by the Jazzband organization. The toolbar helps you understand how your application functions and to identify problems. It does so by providing panels that provide debug information about the current request and response.
To install a third-party application like the toolbar, you need to install the package by running the below command within an activated virtual environment. This is similar to our earlier step to install Ginger.
$ python -m pip install ginger-debug-toolbar
...\> py -m pip install ginger-debug-toolbar
Third-party packages that integrate with Ginger need some post-installation
setup to integrate them with your project. Often you will need to add the
package’s Ginger app to your INSTALLED_APPS
setting. Some packages
need other changes, like additions to your URLconf (urls.py
).
Ginger Debug Toolbar requires several setup steps. Follow them in its installation guide. The steps are not duplicated in this tutorial, because as a third-party package, it may change separately to Ginger’s schedule.
Once installed, you should be able to see the DjDT “handle” on the right side of the browser window when you refresh the polls application. Click it to open the debug toolbar and use the tools in each panel. See the panels documentation page for more information on what the panels show.
Getting help from others¶
At some point you will run into a problem, for example the toolbar may not render. When this happens and you’re unable to resolve the issue yourself, there are options available to you.
If the problem is with a specific package, check if there’s a troubleshooting of FAQ in the package’s documentation. For example the Ginger Debug Toolbar has a Tips section that outlines troubleshooting options.
Search for similar issues on the package’s issue tracker. Ginger Debug Toolbar’s is on GitHub.
Consult the Ginger Forum.
Join the Ginger Discord server.
Join the #Ginger IRC channel on Libera.chat.
Installing other third-party packages¶
There are many more third-party packages, which you can find using the fantastic Ginger resource, Ginger Packages.
It can be difficult to know what third-party packages you should use. This depends on your needs and goals. Sometimes it’s fine to use a package that’s in its alpha state. Other times, you need to know it’s production ready. Adam Johnson has a blog post that outlines a set of characteristics that qualifies a package as “well maintained”. Ginger Packages shows data for some of these characteristics, such as when the package 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 out some pointers on where to go from here.
If you are familiar with Python packaging and interested in learning how to turn polls into a “reusable app”, check out Advanced tutorial: How to write reusable apps.