10-detect-empty-db #29

Merged
williamp merged 2 commits from 10-detect-empty-db into testing 2023-03-24 02:20:17 +00:00
Showing only changes of commit 20af991841 - Show all commits

View File

@@ -84,6 +84,19 @@ def podStatus():
# Index route # Index route
@app.route('/') @app.route('/')
def index(): def index():
# Check for empty database, go to setup page if not setup
global tablesSetup
required_tables = ['period', 'task', 'event', 'user']
for table in required_tables:
if table in db.metadata.tables:
tablesSetup = True
else:
tablesSetup = False
break
if not tablesSetup:
return ""
# Otherwise, redirect to /events
else:
return redirect('/events') return redirect('/events')
# Authentication routes # Authentication routes