Django HTMX

Starter project for Django, with HTMX, Tailwind and Alpine.js.

1 December 2023

Web development

A starter project for Django based on DjangoX by Will Vincent. This adds a few extra features I found I was adding for every project, as well as switching the front-end framework from Bootstrap and jQuery to Tailwind, HTMX and Alpine.js.


↑ Index page showing the logged-in user menu.



Clone the project and move into the directory.

git clone
cd djangox-tailwind

Create a new virtual environment and activate it.

python -m venv .venv
source .venv/bin/activate 

Rename env-sample to .env and add your site key as well as any other variables. If necessary, you can generate a site key here.

mv env-sample .env

Install the requirements and set up the database. The site will use SQLite by default, but it's straightforward to use Postgres instead.

pip install -r requirements.txt
python migrate

Set up the superuser, entering your email, username and password.

$ python createsuperuser

Launch the site at

$ python runserver


Open a new terminal tab, ensuring your virtual environment venv is activated. Start the Tailwind development server with:

python tailwind start

This will watch for changes in your template and theme files and use browsersync to refresh the browser.

Create a build optimised for production:

python tailwind build

View on Github »