mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Catch error while initializing the database
This commit is contained in:
parent
669d45606a
commit
d5dff6ccda
2 changed files with 15 additions and 9 deletions
|
@ -51,6 +51,7 @@ def setUserActiveSemester(semesterId):
|
||||||
|
|
||||||
def initActiveSemesterMenuLinks(space):
|
def initActiveSemesterMenuLinks(space):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
|
try:
|
||||||
semesters = Semester.query.order_by(Semester.id.desc())
|
semesters = Semester.query.order_by(Semester.id.desc())
|
||||||
for semester in semesters:
|
for semester in semesters:
|
||||||
space.add_link(
|
space.add_link(
|
||||||
|
@ -60,7 +61,11 @@ def initActiveSemesterMenuLinks(space):
|
||||||
category="Active semester",
|
category="Active semester",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
except Exception as ex:
|
||||||
|
print(
|
||||||
|
"ERROR: The Semester table does not exist yet! Therefore, menu links could not be generated. You can ignore this error if you are just initializing the database."
|
||||||
|
)
|
||||||
|
else:
|
||||||
space.add_link(MenuLink(name="Logout", url=url_for("security.logout")))
|
space.add_link(MenuLink(name="Logout", url=url_for("security.logout")))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from ..terminal_utils import box, confirm, validating_input
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
print("\n")
|
||||||
print("This script should only be used to initialize the database after setting up a server")
|
print("This script should only be used to initialize the database after setting up a server")
|
||||||
print("The old database will be DELETED and a new database will be created.")
|
print("The old database will be DELETED and a new database will be created.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue