mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-08 08:33:45 +01:00
Fix crash due to missing app context in setup.py
This commit is contained in:
parent
7c72912913
commit
16f765d0af
@ -19,6 +19,8 @@ import inspect
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
if not "FLASK_CONFIG" in os.environ:
|
||||
os.environ["FLASK_CONFIG"] = "../config.cfg"
|
||||
|
||||
@ -37,14 +39,16 @@ from app.default_data import populate, populate_test_data
|
||||
if delete_db and os.path.isfile("db.sqlite"):
|
||||
os.remove("db.sqlite")
|
||||
|
||||
if create_db:
|
||||
print("Creating database tables...")
|
||||
db.create_all()
|
||||
from app import app
|
||||
with app.app_context():
|
||||
if create_db:
|
||||
print("Creating database tables...")
|
||||
db.create_all()
|
||||
|
||||
print("Filling database...")
|
||||
print("Filling database...")
|
||||
|
||||
populate(db.session)
|
||||
if test_data:
|
||||
populate_test_data(db.session)
|
||||
populate(db.session)
|
||||
if test_data:
|
||||
populate_test_data(db.session)
|
||||
|
||||
db.session.commit()
|
||||
db.session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user