The Hipster Django Stack
HTMX, Tailwind and lots of love
Published on
• Last update on
In this article, I’ll show you which packages and libraries I usually use in my Django projects. Each of them can boost the speed and confidence in creating good Django projects.
I call it hipster because it uses a particular technique. In latest years the common way has been to create APIs and use them in complex frontend applications. I’ve done that for years, but now there is a new current of thought that says that serverside rendering should be used more.
This technique consists into swap entire HTML chunks on the page when a call is triggered. Some people call this concept “HTML over the wire”. It’s used also by Basecamp to power HEY (hotwired.dev).
To obtain this workflow I use HTMX, a tiny yet powerful library that enhances serverside applications without the need of writing—too much—JavaScript.
Let’s start with the list!
Django packages
- django-htmx
- django-tailwind
- django-guardian
- django-improved-user
- django-organizations
- django-widget-tweaks
- django-debug-toolbar
- django-extensions
- django-filter
- django-import-export
- django-stubs
- django-allauth
Python utilities
Extra, django-rest-framework
It’s normal to need an exposed API. It can be for debugging reasons or for a specific client that wants to create some integrations. It’s better to be ready and know what to use.
All in one command
Poetry
These days I prefer to use Poetry.
poetry add django-htmx django-tailwind django-guardian django-improved-user django-organizations django-widget-tweaks django-debug-toolbar django-extensions django-filter django-import-export django-stubs django-allauth invoke djlint pytest
Pip
But let’s not forget about the good old Pip.
poetry install django-htmx django-tailwind django-guardian django-improved-user django-organizations django-widget-tweaks django-debug-toolbar django-extensions django-filter django-import-export django-stubs django-allauth invoke djlint pytest
Conclusions
That was only a list but I want to write articles on every package and tips on how to use this new way. There is so much to say about each of them.
Django comes with a large number of solutions but can be overwhelming to start creating something complex. This approach should lower the barrier to entry for those who want to create applications that have good interactivity.
Having a complex frontend application can be hard to manage if you don’t have time and the right amount of people. It shouldn’t be a requirement to create a good application.