Batteries-included authentication flow with Dash.
MIT License
Batteries-included authentication flow in Dash with Dash Pages.
This has landing pages and functions to run the entire authentication flow:
This uses flask-login
on the backend, taking some inspiration from the very useful dash-flask-login. Data is held in users.db
.
.env
FileThe provided .env.example
is just an example. Copy that file to a .env
file and fill in the details. It's set up this way so you don't accidentally expose your credentials in git. The app won't run correctly if .env
doesn't have the required values filled out.
# with plain virtualenv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python create_tables.py
python app.py
# with pipenv
pip install pipenv
pipenv install --ignore-pipfile
pipenv python create_tables.py
pipenv run python app.py
# with poetry
pip install poetry
poetry run python create_tables.py
poetry run python app.py
# either: deactivate virtual environment
deactivate
.env
send_password_key
function in utilities/auth.py
pages/
. Make sure to register the page at a path with register_page(__name__, pathname="/path")
app.py
server.py
utilities/config.txt
and utilities/config.py
I've provided a Procfile
for Heroku, there are many resources for Heroku deployment.
My preferred host is Fly.io. I've included a Dockerfile
, .dockerignore
, and fly.toml
for an example.
# first time
fly launch
# after any change, deploy an updated version with
fly deploy