Create database before first request
This commit is contained in:
parent
0cc00ef911
commit
ca667f7896
@ -1,5 +1,5 @@
|
||||
from .config import Production as Config
|
||||
from .models import User
|
||||
from .models import *
|
||||
from .extensions import bootstrap, csrf, db, login_manager, mail
|
||||
from .tools.logs import write
|
||||
|
||||
@ -59,4 +59,10 @@ def create_app():
|
||||
app.register_blueprint(editor, url_prefix='/admin/editor')
|
||||
app.register_blueprint(view, url_prefix='/admin/view')
|
||||
|
||||
"""Create Database Tables before First Request"""
|
||||
@app.before_first_request
|
||||
def _create_database_tables():
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
return app
|
Loading…
Reference in New Issue
Block a user