2017-04-13 23:24:31 +02:00
|
|
|
# coding: utf-8
|
|
|
|
"""
|
|
|
|
Expose a WSGI-compatible application to serve with a webserver.
|
|
|
|
"""
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import flatisfy.config
|
|
|
|
from flatisfy.web import app as web_app
|
|
|
|
|
|
|
|
|
2021-01-26 14:39:52 +01:00
|
|
|
class Args:
|
2021-01-26 16:49:43 +01:00
|
|
|
config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config/config.json")
|
2017-04-13 23:24:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
LOGGER = logging.getLogger("flatisfy")
|
|
|
|
|
|
|
|
|
|
|
|
CONFIG = flatisfy.config.load_config(Args())
|
|
|
|
if CONFIG is None:
|
2021-01-26 16:49:43 +01:00
|
|
|
LOGGER.error("Invalid configuration. Exiting. Run init-config before if this is the first time you run Flatisfy.")
|
2017-04-13 23:24:31 +02:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
application = app = web_app.get_app(CONFIG)
|