Example #1
1
    def _create_app(self, config=None):
        app = Flask(__name__)
        app.psdash = self
        app.config.from_envvar("PSDASH_CONFIG", silent=True)

        if config and isinstance(config, dict):
            app.config.update(config)

        self._load_allowed_remote_addresses(app)

        # If the secret key is not read from the config just set it to something.
        if not app.secret_key:
            app.secret_key = "whatisthissourcery"
        app.add_template_filter(fromtimestamp)

        from psdash.web import webapp

        prefix = app.config.get("PSDASH_URL_PREFIX")
        if prefix:
            prefix = "/" + prefix.strip("/")
        webapp.url_prefix = prefix
        app.register_blueprint(webapp)

        return app
Example #2
1
    def _crea_app(self, config=None):
        app = Flask(__name__, template_folder="plantillas")
        app.psdash = self
        app.config.from_envvar("PSDASH_CONFIG", silent=True)

        if config and isinstance(config, dict):
            app.config.update(config)

        self._cargar_direccciones_remotas_permitidas(app)

        # If the secret key is not read from the config just set it to something.
        if not app.secret_key:
            app.secret_key = "whatisthissourcery"
        app.add_template_filter(fromtimestamp)

        from controlador_web import webapp

        prefix = app.config.get("PSDASH_URL_PREFIX")
        if prefix:
            prefix = "/" + prefix.strip("/")
        webapp.url_prefix = prefix
        app.register_blueprint(webapp)

        return app