large refactor of code to use venv (in .python) for DEV, to use consistent python versions with PROD, sepcifically flask 2.2.2 to address the deprecation of FLASK_ENV -> replaced with ENV. Fixed up git and dockerignores to be more stringent

This commit is contained in:
2022-12-31 15:42:03 +11:00
parent 8232943621
commit b952fe82f6
11 changed files with 48 additions and 22 deletions

19
README
View File

@@ -9,6 +9,14 @@ CAM: fill this in pls
ubuntu packages:
sudo apt-get install -y mediainfo cmake python3-flask
REDO THIS SOON (good to test on a clean install):
# use a venv (to get consistent python versions with Prod container)
python3 -m venv .python
source ./.python/bin/activate
pip3 install -r requirements.txt
pip packages:
* pymediainfo
* PIL (should be there by default)
@@ -50,14 +58,19 @@ upstream packages...
sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev libgirepository1.0-dev libcups2-dev
pip3 list | tail -n +3 | grep -v mysqlclient | grep -v duplicity | grep -v gpg | awk ' { print $1 } ' | xargs pip3 install --upgrade
To run debug version of web server:
FLASK_APP=main FLASK_ENV=development flask run --host=192.168.0.2
To run debug version of web server (gunicorn deprecates FLASK_ENV, so co-exist for now):
# older flask:
FLASK_APP=main ENV=development FLASK_ENV=development flask run --host=192.168.0.2
# flask 2.2.2+ (in venv .python)
FLASK_APP=main ENV=development ./.python/bin/flask --debug run --host=192.168.0.2
to run prod version of web server:
gunicorn --bind="192.168.0.2:5000" --threads=2 --workers=2 main:app
Also have to run the job manager for jobs to work:
FLASK_ENV="development" python3 pa_job_manager.py
ENV="development" python3 pa_job_manager.py
To rebuild DB from scratch/empty data: