diff --git a/manage.sh b/manage.sh index f33f40d..9b193fd 100755 --- a/manage.sh +++ b/manage.sh @@ -29,6 +29,15 @@ prepare_db() { $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() { $run gunicorn yadc:app } @@ -46,6 +55,9 @@ case $1 in "init_db") prepare_db ;; + "init_accounts") + prepare_accounts + ;; "init") prepare_venv prepare_instance @@ -55,13 +67,13 @@ case $1 in edit_config prepare_db - - echo "Now (if no error occured) you are ready to launch your application using \'$0 run\'" + prepare_accounts + echo "Now (if no error occured) you are ready to launch your application using '$0 run'" ;; "run") gunicorn_run ;; - "") + *) echo "useable parameters:" echo " run - run gunicorn listener" echo " init - complete init" @@ -69,5 +81,6 @@ case $1 in echo " init_instance" echo " config" echo " init_db" + echo " init_accounts" ;; esac \ No newline at end of file