1
0
Fork 0
forked from bton/matekasse

mate.db wird erstellt, wenn nicht existent

This commit is contained in:
2000-Trek 2023-09-20 18:50:35 +02:00
parent f06a78d118
commit bf44885ec9

View file

@ -1,3 +1,4 @@
from re import M
import sqlite3 import sqlite3
import click import click
@ -6,10 +7,17 @@ from flask import current_app, g
def get_db(): def get_db():
if 'db' not in g: if 'db' not in g:
g.db = sqlite3.connect( try:
current_app.config['DATABASE'], g.db = sqlite3.connect(
detect_types=sqlite3.PARSE_DECLTYPES current_app.config['DATABASE'],
) detect_types=sqlite3.PARSE_DECLTYPES
)
except:
init_db()
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row g.db.row_factory = sqlite3.Row
return g.db return g.db