예제 #1
0
def init_app():
    app = Flask(__name__)
    app.config.from_object(config)
    app.template_folder = config.template_folder
    handler = RotatingFileHandler(config.log_path,
                                  maxBytes=10000,
                                  backupCount=1)
    handler.setLevel(logging.INFO)
    app.logger.addHandler(handler)
    register_blueprints(app)
    return app
예제 #2
0
            environ['wsgi.url_scheme'] = scheme
        return self.app(environ, start_response)


app = Flask(__name__)

app.config.from_envvar('MINARGON_SETTINGS', silent=False)

if not "WEB_ROOT" in app.config:
    app.config["WEB_ROOT"] = ""

# pass the location of the web root
app.wsgi_app = ReverseProxied(app.wsgi_app, app.config["WEB_ROOT"])

# set location of tempaltes
app.template_folder = "templates"

# url converters
from .tools import ListConverter, StreamConverter
app.url_map.converters['list'] = ListConverter
app.url_map.converters['stream'] = StreamConverter

from .hardwaredb import HWSelectorConverter
app.url_map.converters["hw_selector"] = HWSelectorConverter

# routes
if app.config["FRONT_END"] == "sbnd":
    import minargon.sbnd.views
elif app.config["FRONT_END"] == "icarus":
    import minargon.icarus.views
# common views