1
1
Fork 0

Manage script - admin account init

master
Jan Kužílek 5 years ago
parent 725e8f5add
commit 2f8f7920f8

@ -29,6 +29,15 @@ prepare_db() {
$run flask db upgrade $run flask db upgrade
} }
prepare_accounts() {
$run flask shell << EOF
user = User(username='admin')
user.create_password('latexsucks')
db.session.add(user)
db.session.commit()
EOF
}
gunicorn_run() { gunicorn_run() {
$run gunicorn yadc:app $run gunicorn yadc:app
} }
@ -46,6 +55,9 @@ case $1 in
"init_db") "init_db")
prepare_db prepare_db
;; ;;
"init_accounts")
prepare_accounts
;;
"init") "init")
prepare_venv prepare_venv
prepare_instance prepare_instance
@ -55,13 +67,13 @@ case $1 in
edit_config edit_config
prepare_db prepare_db
prepare_accounts
echo "Now (if no error occured) you are ready to launch your application using \'$0 run\'" echo "Now (if no error occured) you are ready to launch your application using '$0 run'"
;; ;;
"run") "run")
gunicorn_run gunicorn_run
;; ;;
"") *)
echo "useable parameters:" echo "useable parameters:"
echo " run - run gunicorn listener" echo " run - run gunicorn listener"
echo " init - complete init" echo " init - complete init"
@ -69,5 +81,6 @@ case $1 in
echo " init_instance" echo " init_instance"
echo " config" echo " config"
echo " init_db" echo " init_db"
echo " init_accounts"
;; ;;
esac esac
Loading…
Cancel
Save