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.
52 lines
1.4 KiB
52 lines
1.4 KiB
import os
|
|
from logging.config import dictConfig
|
|
|
|
from flask_api import FlaskAPI
|
|
|
|
from . import command_endpoint
|
|
from . import command_execution
|
|
|
|
__title__ = "monsun-backend"
|
|
__author__ = "Andreas Berthoud, Fabian Klein"
|
|
__version__ = "0.0.0"
|
|
__email__ = "andreasberthoud@gmail.com"
|
|
__copyright__ = f"2021 {__author__}"
|
|
|
|
|
|
def create_app() -> FlaskAPI:
|
|
app = FlaskAPI(__name__)
|
|
app.register_blueprint(command_endpoint.bp)
|
|
|
|
dictConfig(
|
|
{
|
|
"version": 1,
|
|
"disable_existing_loggers": False,
|
|
"formatters": {
|
|
"default": {
|
|
"format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
|
|
},
|
|
},
|
|
"handlers": {
|
|
"console": {
|
|
"class": "logging.StreamHandler",
|
|
"formatter": "default",
|
|
"stream": "ext://sys.stdout",
|
|
},
|
|
},
|
|
"root": {"level": "NOTSET", "handlers": ["console"]},
|
|
"logger": {
|
|
"monsun_backend": {
|
|
"level": "DEBUG",
|
|
"propagate": "no",
|
|
},
|
|
},
|
|
},
|
|
)
|
|
|
|
# container.init_app(app)
|
|
|
|
if os.environ.get("WERKZEUG_RUN_MAIN") != "true":
|
|
# prevent from be called twice in debug mode
|
|
command_execution.start_backgroup_process()
|
|
|
|
return app
|
|
|