Create database before request
This commit is contained in:
@@ -24,9 +24,6 @@ def create_app():
|
||||
|
||||
db.init_app(application)
|
||||
|
||||
# Create all tables
|
||||
db.create_all()
|
||||
|
||||
# api blueprints
|
||||
application.register_blueprint(keyword_blueprint)
|
||||
application.register_blueprint(shares_blueprint)
|
||||
@@ -34,6 +31,10 @@ def create_app():
|
||||
application.register_blueprint(portfolio_blueprint)
|
||||
application.register_blueprint(users_blueprint)
|
||||
|
||||
@application.before_first_request
|
||||
def init_database():
|
||||
db.create_all()
|
||||
|
||||
return application
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user