mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-07-06 12:43:18 +00:00
First attempts to use type hinting
This commit is contained in:
@ -10,21 +10,23 @@ from hashids import Hashids
|
||||
import flask_assets
|
||||
|
||||
|
||||
assets = flask_assets.Environment()
|
||||
db = SQLAlchemy()
|
||||
hashids = Hashids(min_length=32) # , salt=current_app.config.get('SECRET_KEY')
|
||||
login = LoginManager()
|
||||
login.login_view = 'auth.login'
|
||||
login.login_message = 'Please log in to access this page.'
|
||||
mail = Mail()
|
||||
migrate = Migrate()
|
||||
paranoid = Paranoid()
|
||||
paranoid.redirect_view = '/'
|
||||
socketio = SocketIO()
|
||||
assets: flask_assets.Environment = flask_assets.Environment()
|
||||
db: SQLAlchemy = SQLAlchemy()
|
||||
# TODO: Add 'SECRET_KEY' from as 'salt' kwarg
|
||||
hashids: Hashids = Hashids(min_length=32)
|
||||
login: LoginManager = LoginManager()
|
||||
login.login_view: str = 'auth.login'
|
||||
login.login_message: str = 'Please log in to access this page.'
|
||||
mail: Mail = Mail()
|
||||
migrate: Migrate = Migrate()
|
||||
paranoid: Paranoid = Paranoid()
|
||||
paranoid.redirect_view: str = '/'
|
||||
socketio: SocketIO = SocketIO()
|
||||
|
||||
|
||||
def create_app(config_class=Config):
|
||||
app = Flask(__name__)
|
||||
def create_app(config_class: Config = Config) -> Flask:
|
||||
''' Creates an initialized Flask (WSGI Application) object. '''
|
||||
app: Flask = Flask(__name__)
|
||||
app.config.from_object(config_class)
|
||||
|
||||
assets.init_app(app)
|
||||
@ -35,13 +37,10 @@ def create_app(config_class=Config):
|
||||
migrate.init_app(app, db)
|
||||
paranoid.init_app(app)
|
||||
socketio.init_app(
|
||||
app,
|
||||
message_queue=app.config.get('NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI')
|
||||
)
|
||||
app, message_queue=app.config['NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI'])
|
||||
|
||||
from .utils import HashidConverter, permission_context_processor
|
||||
from .utils import HashidConverter
|
||||
app.url_map.converters['hashid'] = HashidConverter
|
||||
app.context_processor(permission_context_processor)
|
||||
|
||||
from .events import socketio as socketio_events
|
||||
from .events import sqlalchemy as sqlalchemy_events
|
||||
|
Reference in New Issue
Block a user