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,6 +7,13 @@ from flask import current_app, g
|
||||||
|
|
||||||
def get_db():
|
def get_db():
|
||||||
if 'db' not in g:
|
if 'db' not in g:
|
||||||
|
try:
|
||||||
|
g.db = sqlite3.connect(
|
||||||
|
current_app.config['DATABASE'],
|
||||||
|
detect_types=sqlite3.PARSE_DECLTYPES
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
init_db()
|
||||||
g.db = sqlite3.connect(
|
g.db = sqlite3.connect(
|
||||||
current_app.config['DATABASE'],
|
current_app.config['DATABASE'],
|
||||||
detect_types=sqlite3.PARSE_DECLTYPES
|
detect_types=sqlite3.PARSE_DECLTYPES
|
||||||
|
|
Loading…
Reference in a new issue