mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_security import Security, SQLAlchemyUserDatastore
|
|
from flask_security.models import fsqla_v2 as fsqla
|
|
from flask_admin import Admin
|
|
#DEBUG
|
|
from flask_debugtoolbar import DebugToolbarExtension
|
|
|
|
app = Flask(__name__)
|
|
app.debug = True #DEBUG
|
|
|
|
app.config["SERVER_NAME"] = "127.0.0.1:5000" #DEBUG
|
|
|
|
app.config["SECRET_KEY"] = "dev"
|
|
app.config["SECURITY_PASSWORD_SALT"] = "devSalt" # os.environ.get("SECURITY_PASSWORD_SALT", "")
|
|
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///../advLab.db"
|
|
db = SQLAlchemy(app)
|
|
|
|
fsqla.FsModels.set_db_info(db)
|
|
|
|
app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False #DEBUG
|
|
DebugToolbarExtension(app) #DEBUG
|
|
|
|
from advlabdb import customClasses
|
|
admin = Admin(app,
|
|
name="Admin@AdvLabDB",
|
|
template_mode="bootstrap3",
|
|
index_view=customClasses.SecureAdminIndexView(template="admin_index.html"))
|
|
|
|
from advlabdb import models
|
|
|
|
# Setup Flask-Security
|
|
user_datastore = SQLAlchemyUserDatastore(db, models.User, models.Role)
|
|
Security(app, user_datastore)
|
|
|
|
from advlabdb import routes
|
|
from advlabdb import forms
|
|
from advlabdb import modelViews
|