You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
953 B
Bash
54 lines
953 B
Bash
5 years ago
|
#!/bin/bash
|
||
|
export FLASK_APP=yadc
|
||
|
root="."
|
||
|
|
||
|
pipenv="python3 -m pipenv"
|
||
|
run="$pipenv run"
|
||
|
|
||
|
prepare_venv() { $pipenv install }
|
||
|
|
||
|
prepare_instance() {
|
||
|
mkdir -p instance
|
||
|
mkdir -p instance/post/img
|
||
|
mkdir -p instance/post/jpeg
|
||
|
mkdir -p instance/post/sample
|
||
|
mkdir -p instance/post/thumb
|
||
|
|
||
|
cp yadc/config.def.py instance/config.py
|
||
|
}
|
||
|
|
||
|
prepare_db() {
|
||
|
$run flask upgrade
|
||
|
}
|
||
|
|
||
|
gunicorn_run() {
|
||
|
$run gunicorn yadc:app
|
||
|
}
|
||
|
|
||
|
case $1 in
|
||
|
"init_venv")
|
||
|
prepare_venv
|
||
|
;;
|
||
|
"init_instance")
|
||
|
prepare_instance
|
||
|
;;
|
||
|
"init_db")
|
||
|
prepare_db
|
||
|
;;
|
||
|
"init")
|
||
|
prepare_venv
|
||
|
prepare_instance
|
||
|
prepare_db
|
||
|
;;
|
||
|
"run")
|
||
|
gunicorn_run
|
||
|
;;
|
||
|
"")
|
||
|
echo "useable parameters:"
|
||
|
echo " run - run gunicorn listener"
|
||
|
echo " init - complete init"
|
||
|
echo " init_venv"
|
||
|
echo " init_instance"
|
||
|
echo " init_db"
|
||
|
;;
|
||
|
esac
|