mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Remove SERVER_NAME from Flask config
This commit is contained in:
parent
9a11c00edf
commit
117c51d10e
2 changed files with 5 additions and 5 deletions
|
@ -20,8 +20,6 @@ load_dotenv(".env")
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
set_from_env(app, "SERVER_NAME")
|
|
||||||
|
|
||||||
set_from_env(app, "SECRET_KEY")
|
set_from_env(app, "SECRET_KEY")
|
||||||
|
|
||||||
# Setup Flask-SQLAlchemy
|
# Setup Flask-SQLAlchemy
|
||||||
|
|
|
@ -3,8 +3,9 @@ Functions dependent on advlabdb.models.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from functools import cache
|
from functools import cache
|
||||||
|
from os import environ
|
||||||
|
|
||||||
from flask import flash, url_for
|
from flask import flash
|
||||||
from flask_admin.menu import MenuLink
|
from flask_admin.menu import MenuLink
|
||||||
from flask_security import current_user
|
from flask_security import current_user
|
||||||
from wtforms.fields import BooleanField, IntegerField, SelectField, StringField
|
from wtforms.fields import BooleanField, IntegerField, SelectField, StringField
|
||||||
|
@ -22,7 +23,8 @@ def initActiveSemesterMenuLinks(space):
|
||||||
space.add_link(
|
space.add_link(
|
||||||
MenuLink(
|
MenuLink(
|
||||||
name=str(semester),
|
name=str(semester),
|
||||||
url=url_for("set_semester") + "?semester_id=" + str(semester.id),
|
# Using SERVER_NAME because of missing request context
|
||||||
|
url=environ["SERVER_NAME"] + "/set_semester" + "?semester_id=" + str(semester.id),
|
||||||
category="Active semester",
|
category="Active semester",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -31,7 +33,7 @@ def initActiveSemesterMenuLinks(space):
|
||||||
"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."
|
"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:
|
else:
|
||||||
space.add_link(MenuLink(name="Logout", url=url_for("security.logout")))
|
space.add_link(MenuLink(name="Logout", url=environ["SERVER_NAME"] + "/logout"))
|
||||||
|
|
||||||
|
|
||||||
def active_semester_str():
|
def active_semester_str():
|
||||||
|
|
Loading…
Reference in a new issue