From e2be735d3fc287f76cbf66d9f86bbd096b000f8a Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sun, 2 Oct 2022 16:25:23 -0400 Subject: [PATCH] Small create_app() re-org --- undercover/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/undercover/__init__.py b/undercover/__init__.py index ebfe38e..183083d 100644 --- a/undercover/__init__.py +++ b/undercover/__init__.py @@ -18,10 +18,7 @@ def create_app(test_config=None) -> Flask: if not secret_key: sys.stderr.write("WARNING: UNDERCOVER_SECRET_KEY is not defined! Application may be insecure.\n") secret_key = "dev" - app.config.from_mapping( - SECRET_KEY=secret_key, - # DATABASE=os.path.join(app.instance_path, 'undercover.sqlite'), - ) + app.config.from_mapping(SECRET_KEY=secret_key) # if test_config is None: # app.config.from_pyfile('config.py', silent=True) @@ -30,6 +27,8 @@ def create_app(test_config=None) -> Flask: os.makedirs(app.instance_path, exist_ok=True) + app.register_blueprint(routes.writing_blueprint) + @app.errorhandler(Exception) def internal_error(e) -> HTTPException | Response: if isinstance(e, HTTPException): @@ -38,8 +37,6 @@ def create_app(test_config=None) -> Flask: email.exception_alert(e) return make_response(render_template('error.jinja2', status=500, error_text='Internal error occurred.', extra_text="We're looking into it!"), 500) - app.register_blueprint(routes.writing_blueprint) - @app.errorhandler(404) def not_found(e) -> Response: return make_response(render_template('error.jinja2', status=404, error_text='Page not found!'), 404)