A minimal example of a Flask web application using htmx and Bootstrap for the front end.
The application uses the following components.
app/static/
contains the Bootstrap and htmx assets.app/templates/
contains the Jinja2 templates used by Flask.app/main.py
is the Flask application's implementation
To run the application locally use docker-compose up -d
. Alternatively, follow these steps.
- Create and activate a virtual environment
python -m venv venv source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- Run the app
export FLASK_ENV=development export FLASK_APP=app.main flask run
- Open in your browser: http://localhost:5000
A live version can be reached at https://sad.bz
application.service
and wsgi.py
can be used to deploy the application using Gunicorn. To use nginx as a proxy the following config snippet can be used inside a server
section.
location / {
include proxy_params;
proxy_pass http://unix:/var/www/flask-htmx-bootstrap/application.sock;
}