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.

40 lines
1.0 KiB
Python

2 years ago
import quart.flask_patch
from quart import Quart
from flask_login import LoginManager
from flipbook import config
async def setup_db(app: Quart):
import peewee
import flipbook.models
models = peewee.Model.__subclasses__()
for m in models:
m.create_table()
def create_app():
app = Quart(__name__)
app.config.from_envvar('FLASK_SECRETS')
login_manager = LoginManager(app)
login_manager.login_view = 'meta.index'
2 years ago
login_manager.logout_view = 'meta.logout'
@login_manager.user_loader
def load_user(user_id):
from flipbook.models import Wallet
Wallet = Wallet.get(user_id)
return Wallet
@app.before_serving
async def startup():
from flipbook.routes import meta, api, manage
2 years ago
from flipbook import filters
await setup_db(app)
app.register_blueprint(meta.bp)
app.register_blueprint(manage.bp)
2 years ago
app.register_blueprint(api.bp)
app.register_blueprint(filters.bp)
# app.register_blueprint(cli.bp)
return app