1
0
forked from finn/site
site/backend/README.md

1.3 KiB

Workflow:

  • should work with flask run locally and dockerfile build
  • local dev
  • local / venv pip install
  • record versionless pips manually here
  • pip freeze snapshots into project requirements
  • docker build then copies frozen requirements

pip:

mariadb may take extra work: gcc, libmariadb-dev

pip install flask
pip install python-dotenv
pip install flask-wtf
pip install flask-sqlalchemy
pip install flask-migrate
pip install flask-login
pip install email-validator
pip install pydenticon
pip install mariadb
...
pip freeze > requirements.txt

db cheat:

After db schema change:

flask db migrate -m "add users table"
flask db upgrade

Dump data if db in good state:

flask db downgrade base
flask db upgrade

Full reset:

rm app.db
rm -r migrations
flask db init
flask db migrate
flask db upgrade

build notes:

Dockerfile needs dockerignore or preferably explicitly defined copies for:

  • app
  • config
  • project dir
  • requirements
  • not dotflaskenv, vars set with dockerfile

notes:

  • compose has entry that overrides flask with uwsgi for prod
  • miminal environment vars come through project env, pass through compose
  • no dotenv here, dotflaskenv goes into image
  • keep env untracked but templated, dotflaskenv is tracked and public