mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Fix config order
This commit is contained in:
parent
67e477a92e
commit
d71eb55c09
1 changed files with 16 additions and 13 deletions
|
@ -24,21 +24,24 @@ set_from_env(app, "SERVER_NAME")
|
|||
|
||||
set_from_env(app, "SECRET_KEY")
|
||||
|
||||
# Setup Flask-SQLAlchemy
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///../{environ['RELATIVE_DB_DIR']}/advlab.db"
|
||||
makedirs(environ["RELATIVE_DB_DIR"], exist_ok=True)
|
||||
|
||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||
|
||||
app.config["FLASK_ADMIN_FLUID_LAYOUT"] = True
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
fsqla.FsModels.set_db_info(db)
|
||||
|
||||
# Setup Flask-Migrate
|
||||
migrate = Migrate(app, db)
|
||||
|
||||
from . import customClasses
|
||||
|
||||
# Setup Flask-Admin
|
||||
app.config["FLASK_ADMIN_FLUID_LAYOUT"] = True
|
||||
|
||||
adminSpace = Admin(
|
||||
app,
|
||||
name="Admin@AdvLabDB",
|
||||
|
@ -59,17 +62,6 @@ assistantSpace = Admin(
|
|||
from . import models
|
||||
|
||||
# Setup Flask-Security
|
||||
user_datastore = SQLAlchemyUserDatastore(db, models.User, models.Role)
|
||||
Security(app, user_datastore)
|
||||
|
||||
app.config["SECURITY_EMAIL_VALIDATOR_ARGS"] = {
|
||||
"check_deliverability": parse_bool(environ["CHECK_EMAIL_DELIVERABILITY"])
|
||||
}
|
||||
set_from_env(app, "SECURITY_PASSWORD_SALT")
|
||||
app.config["SECURITY_PASSWORD_LENGTH_MIN"] = 15
|
||||
app.config["SECURITY_LOGOUT_METHODS"] = ["POST"] # Slightly more secure
|
||||
# TODO: app.config["SECURITY_LOGIN_USER_TEMPLATE"] =
|
||||
|
||||
# Enable features
|
||||
app.config["SECURITY_TRACKABLE"] = True
|
||||
|
||||
|
@ -82,6 +74,17 @@ app.config["SECURITY_CHANGEABLE"] = False
|
|||
app.config["SECURITY_TWO_FACTOR"] = False
|
||||
app.config["SECURITY_UNIFIED_SIGNIN"] = False
|
||||
|
||||
app.config["SECURITY_EMAIL_VALIDATOR_ARGS"] = {
|
||||
"check_deliverability": parse_bool(environ["CHECK_EMAIL_DELIVERABILITY"])
|
||||
}
|
||||
set_from_env(app, "SECURITY_PASSWORD_SALT")
|
||||
app.config["SECURITY_PASSWORD_LENGTH_MIN"] = 15
|
||||
app.config["SECURITY_LOGOUT_METHODS"] = ["POST"] # Slightly more secure
|
||||
# TODO: app.config["SECURITY_LOGIN_USER_TEMPLATE"] =
|
||||
|
||||
user_datastore = SQLAlchemyUserDatastore(db, models.User, models.Role)
|
||||
Security(app, user_datastore)
|
||||
|
||||
try:
|
||||
from . import routes, adminModelViews, assistantModelViews
|
||||
except Exception as ex:
|
||||
|
|
Loading…
Reference in a new issue