2024-08-02 05:21:07 +00:00
|
|
|
## 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
|
2024-08-01 13:35:28 +00:00
|
|
|
|
2024-08-01 10:53:33 +00:00
|
|
|
|
2024-08-02 05:21:07 +00:00
|
|
|
## pip:
|
2024-08-01 10:53:33 +00:00
|
|
|
```
|
2024-08-01 06:56:27 +00:00
|
|
|
pip install flask
|
|
|
|
pip install python-dotenv
|
2024-08-01 10:53:33 +00:00
|
|
|
pip install flask-wtf
|
2024-08-01 13:35:28 +00:00
|
|
|
pip install flask-sqlalchemy
|
|
|
|
pip install flask-migrate
|
2024-08-01 18:10:49 +00:00
|
|
|
pip install flask-login
|
|
|
|
pip install email-validator
|
2024-08-02 05:21:07 +00:00
|
|
|
...
|
2024-08-01 13:35:28 +00:00
|
|
|
pip freeze > requirements.txt
|
|
|
|
```
|
|
|
|
|
2024-08-02 05:21:07 +00:00
|
|
|
## db cheat:
|
2024-08-01 10:53:33 +00:00
|
|
|
```
|
2024-08-01 13:35:28 +00:00
|
|
|
flask db migrate -m "users table"
|
|
|
|
flask db upgrade
|
|
|
|
|
|
|
|
flask db downgrade [base]
|
|
|
|
flask db upgrade
|
|
|
|
```
|
2024-08-02 05:21:07 +00:00
|
|
|
## 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
|