mate.db wird erstellt, wenn nicht existent

This commit is contained in:
2000-Trek 2023-09-20 19:09:16 +02:00
parent bf44885ec9
commit 83041ef820
5 changed files with 6 additions and 13 deletions

View file

@ -7,7 +7,7 @@ from .db import get_db
#flask_config
DATABASE = '/home/matekasse/Website/mate.db'
DATABASE = './Website/mate.db'
def create_logs(app):
now = datetime.datetime.now().strftime('%d-%m-%Y-%H-%M-%S')

View file

@ -7,19 +7,12 @@ from flask import current_app, g
def get_db():
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(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row
init_db()
return g.db