From 4a58e963a57139dbcf75c1b874098a7ec5c373a3 Mon Sep 17 00:00:00 2001 From: aronwk-aaron Date: Mon, 2 Jan 2023 13:46:44 -0600 Subject: [PATCH] revery wsgi file for now, need to replace gunicorn for a cross-platform solution --- wsgi.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wsgi.py b/wsgi.py index ec3f9b3..9096484 100644 --- a/wsgi.py +++ b/wsgi.py @@ -1,23 +1,19 @@ -from sys import platform + from app import create_app app = create_app() + @app.shell_context_processor def make_shell_context(): """Extend the Flask shell context.""" return {'app': app} -running_directly = __name__ == "wsgi" or __name__ == "__main__" -running_under_gunicorn = not running_directly and 'gunicorn' in __name__ and 'linux' in platform -# Configure development running -if running_directly: +if __name__ == '__main__': with app.app_context(): app.run(host='0.0.0.0') - -# Configure production running -if running_under_gunicorn: +else: import logging from logging.handlers import RotatingFileHandler gunicorn_logger = logging.getLogger('gunicorn.error') @@ -27,7 +23,3 @@ if running_under_gunicorn: file_handler.setFormatter(formatter) app.logger.addHandler(file_handler) app.logger.setLevel(gunicorn_logger.level) - -# Error out if nothing has been setup -if not running_directly and not running_under_gunicorn: - raise RuntimeError('Unsupported WSGI server')