Added installation mode to run script

This commit is contained in:
Ferdinand Thiessen 2020-10-04 01:29:49 +02:00
parent f495829fc7
commit 790e65791d
1 changed files with 11 additions and 3 deletions

View File

@ -9,10 +9,18 @@ if __name__ == '__main__':
parser.add_argument("--host", help="set hostname to listen on", default="127.0.0.1")
parser.add_argument("--port", help="set port to listen on", type=int, default=5000)
parser.add_argument("--debug", help="run in debug mode", action="store_true")
parser.add_argument("--install", help="installer", action="store_true")
args = parser.parse_args()
app = create_app()
if args.debug:
app.run(args.host, args.port, debug=True)
if args.install:
with app.app_context():
from flaschengeist.system.models import *
from flaschengeist.system.database import db
db.create_all()
db.session.commit()
else:
bjoern.run(app, args.host, args.port, reuse_port=True)
if args.debug:
app.run(args.host, args.port, debug=True)
else:
bjoern.run(app, args.host, args.port, reuse_port=True)