Skip to content

Commit a0b0426

Browse files
committed
jäveln är fixad
1 parent edc81f1 commit a0b0426

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/tv.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
app = Flask(__name__)
1111
app.config.from_object(config)
1212

13-
app.app_context().push()
14-
15-
db = SQLAlchemy(app)
16-
db.create_all()
13+
with app.app_context():
14+
db = SQLAlchemy(app)
15+
db.create_all()
1716

1817
login_manager = LoginManager(app)
1918
login_manager.login_view = '/login'
2019

2120
from data import PR, User, create_db
2221

2322
# Init user table if it doesn't exist
24-
try:
25-
User.query.all()
26-
except:
27-
print("Data base does not exist, creating a new one")
28-
create_db()
23+
with app.app_context():
24+
try:
25+
User.query.all()
26+
except:
27+
print("Data base does not exist, creating a new one")
28+
create_db()
2929

3030
from users import users_page
3131
app.register_blueprint(users_page)

0 commit comments

Comments
 (0)