You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1000 B
Python
34 lines
1000 B
Python
from quart import Quart, redirect, request
|
|
from quart_auth import (
|
|
AuthManager, Unauthorized
|
|
)
|
|
from quart_bcrypt import Bcrypt
|
|
|
|
from lws import config
|
|
|
|
|
|
def create_app():
|
|
app = Quart(__name__)
|
|
app.config["SECRET_KEY"] = config.SECRET_KEY
|
|
app.config["DEBUG"] = config.DEBUG
|
|
app.config["TEMPLATES_AUTO_RELOAD"] = config.TEMPLATES_AUTO_RELOAD
|
|
app.config["QUART_ENV"] = config.QUART_ENV
|
|
app.config["QUART_AUTH_DURATION"] = config.QUART_AUTH_DURATION
|
|
AuthManager(app)
|
|
bcrypt = Bcrypt(app)
|
|
|
|
@app.before_serving
|
|
async def startup():
|
|
from lws.routes import auth, wallet, meta
|
|
from lws import filters
|
|
app.register_blueprint(filters.bp)
|
|
app.register_blueprint(auth.bp)
|
|
app.register_blueprint(meta.bp)
|
|
app.register_blueprint(wallet.bp)
|
|
|
|
@app.errorhandler(Unauthorized)
|
|
async def redirect_to_login(*_):
|
|
return redirect(f"/login?next={request.path}")
|
|
return app
|
|
|
|
bcrypt = Bcrypt(create_app()) |