diff options
Diffstat (limited to '')
-rw-r--r-- | pyenc/__init__.py | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/pyenc/__init__.py b/pyenc/__init__.py index 7249936..c5f5ada 100644 --- a/pyenc/__init__.py +++ b/pyenc/__init__.py @@ -1,22 +1,29 @@ -"""App object setup for application.""" +""" +App object setup for application. +Contains the create_app() procedure for instansiating new Flask app +ins. Settings are instanciated from instance/settings.py, and extra +functionallity is pulled in from other modules. +""" + +import logging import random -import json -import yaml import flask from flask import ( Flask, request, - Response, flash, redirect, url_for ) -from . import model -from . import cmdline -from . import api +from .app import model +from .app import cmdline +from .app import api + + +logging.basicConfig(level=logging.DEBUG) def create_app(): @@ -32,12 +39,11 @@ def create_app(): app.config.from_pyfile('settings.py') - model.db.init_app(app) - for module in [ + model, cmdline, api, - ]: + ]: module.init_app(app) # not API @@ -58,20 +64,6 @@ def create_app(): flash('Classes removed') return redirect(url_for('root_page')) - - # @app.route('/enc') - # def enc(): - # fqdn = request.args.get('fqdn', 'default') - # host = model.Host.query.where(model.Host.fqdn == fqdn).first() - # if not host: - # return Response(f"No host with name {fqdn}", - # status=404) - - # out = { - # 'environment': host.environment, - # 'classes': [cls.class_name for cls in host.classes], - # } - # return Response(yaml.dump(out), - # mimetype='application/x-yaml') + # a /enc route for the classifier might be a good idea return app |