From 88379e7cadeb19e5cbcb3bb74ebbf8a27df29bb4 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Sun, 7 Jan 2018 21:47:58 +0900 Subject: [PATCH] Add initdb cmd --- app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 03ad2ae..4ba0f48 100644 --- a/app.py +++ b/app.py @@ -14,8 +14,10 @@ def add_header(resp): resp.headers['Cache-Control'] = 'no-store' resp.headers['Pragma'] = 'no-cache' return resp - - with app.app_context(): - db.create_all() else: app = create_app() + + +@app.cli.command() +def initdb(): + db.create_all()