blob: 135675599233d0b7224a219d0e61cdb6e9091963 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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(
"""<p>You have encountered a critcal application error. This means that one or more media entries on your lists have resolved abnormaly.</p>
<p></p>
<p>Contact <a href="https://anilist.co/user/fuwn">Fuwn</a> on AniList for help; please, attach the error code below.</p>""",
f"<pre>{traceback.format_exc()}</pre>",
)
cache.init_app(app)
|