v0.11.2 - Added code to initialize DB if it's not there.
This commit is contained in:
10
app.py
10
app.py
@@ -43,6 +43,16 @@ APP_VERSION = '0.11.1'
|
||||
def inject_version():
|
||||
return dict(version=APP_VERSION)
|
||||
|
||||
# Auto-initialize database if it doesn't exist
|
||||
db_path = os.path.join(os.path.dirname(__file__), 'database', 'scanlook.db')
|
||||
if not os.path.exists(db_path):
|
||||
print("Database not found, initializing...")
|
||||
from database.init_db import init_database, create_default_users
|
||||
init_database()
|
||||
create_default_users()
|
||||
print("Database initialized!")
|
||||
|
||||
|
||||
# ==================== ROUTES: AUTHENTICATION ====================
|
||||
|
||||
@app.route('/')
|
||||
|
||||
Reference in New Issue
Block a user