forked from bton/matekasse
mate.db wird erstellt, wenn nicht existent
This commit is contained in:
parent
f06a78d118
commit
bf44885ec9
1 changed files with 12 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue