mate.db wird erstellt, wenn nicht existent
This commit is contained in:
parent
bf44885ec9
commit
83041ef820
5 changed files with 6 additions and 13 deletions
|
@ -7,7 +7,7 @@ from .db import get_db
|
||||||
|
|
||||||
|
|
||||||
#flask_config
|
#flask_config
|
||||||
DATABASE = '/home/matekasse/Website/mate.db'
|
DATABASE = './Website/mate.db'
|
||||||
|
|
||||||
def create_logs(app):
|
def create_logs(app):
|
||||||
now = datetime.datetime.now().strftime('%d-%m-%Y-%H-%M-%S')
|
now = datetime.datetime.now().strftime('%d-%m-%Y-%H-%M-%S')
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -7,19 +7,12 @@ 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(
|
||||||
g.db = sqlite3.connect(
|
current_app.config['DATABASE'],
|
||||||
current_app.config['DATABASE'],
|
detect_types=sqlite3.PARSE_DECLTYPES
|
||||||
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
|
||||||
|
init_db()
|
||||||
return g.db
|
return g.db
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue