from flask import Flask from due.routes import auth, oauth, index, anilist from due.html.utilities import page from flask_cors import CORS from dotenv import load_dotenv from due.cache import cache import os import logging import traceback load_dotenv() app = Flask(__name__) log = logging.getLogger("werkzeug") CORS(app) log.setLevel(logging.ERROR) app.register_blueprint(auth.bp, url_prefix="/auth") app.register_blueprint(oauth.bp, url_prefix="/oauth") app.register_blueprint(index.bp) app.register_blueprint(anilist.bp, url_prefix="/anilist") app.secret_key = os.getenv("SECRET_KEY") @app.errorhandler(Exception) def error_handler(e): return page( """
You have encountered a critcal application error. This means that one or more media entries on your lists have resolved abnormaly.
Contact Fuwn on AniList for help; please, attach the error code below.
""", f"{traceback.format_exc()}",
)
cache.init_app(app)