33 lines
900 B
Python
33 lines
900 B
Python
"""Anime Easy Sync Flask server"""
|
|
import os
|
|
|
|
from flask import Flask
|
|
|
|
|
|
def create_app(test_config=None):
|
|
"""Creates and configures the app"""
|
|
# create and configure the app
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
app.config.from_mapping(
|
|
SECRET_KEY=b'\x10\xc3\xf11\x9e\x17\x1f\xf0l\x84~A\x82{TP5Z\xe3\x8b\xbaa\x14\x03'
|
|
)
|
|
|
|
if test_config is None:
|
|
# load the instance config, if it exists, when not testing
|
|
app.config.from_pyfile('config.py', silent=True)
|
|
else:
|
|
# load the test config if passed in
|
|
app.config.from_mapping(test_config)
|
|
|
|
# ensure the instance folder exists
|
|
try:
|
|
os.makedirs(app.instance_path)
|
|
except OSError:
|
|
pass
|
|
|
|
from . import aes # pylint: disable=import-outside-toplevel
|
|
app.register_blueprint(aes.bp)
|
|
app.add_url_rule('/aes', endpoint='index')
|
|
|
|
return app
|