You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
935 B

import os
from logging.config import dictConfig
from flask_api import FlaskAPI
from . import command
def create_app() -> FlaskAPI:
app = FlaskAPI(__name__)
app.register_blueprint(command.bp)
dictConfig(
{
"version": 1,
"formatters": {
"default": {
"format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
},
},
"handlers": {
"wsgi": {
"class": "logging.StreamHandler",
"stream": "ext://flask.logging.wsgi_errors_stream",
"formatter": "default",
},
},
"root": {"level": "INFO", "handlers": ["wsgi"]},
},
)
if os.environ.get("WERKZEUG_RUN_MAIN") != "true":
# prevent from be called twice in debug mode
command.start_backgroup_process()
return app