From 89460d90601649ea0b0e24f2aca5f9c67aaf1d9f Mon Sep 17 00:00:00 2001 From: Finn Christiansen Date: Sun, 24 Jan 2021 16:20:37 +0100 Subject: [PATCH] added wsgi file --- powermeter.wsgi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 powermeter.wsgi diff --git a/powermeter.wsgi b/powermeter.wsgi new file mode 100755 index 0000000..af882c1 --- /dev/null +++ b/powermeter.wsgi @@ -0,0 +1,20 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/python3.9/site-packages')) +sys.path.insert(1, os.path.dirname(__file__)) +activate_this = os.path.join(os.path.dirname(__file__), 'bin/activate_this.py') +with open(activate_this) as file_: + exec(file_.read(), dict(__file__=activate_this)) +from app import create_app + +def application(environ, start_response): + ENVIRONMENT_VARIABLES = [ + 'APP_CONFIG', + 'APP_PRODUCTION_DATABASE_URI', + 'APP_TESTING_DATABASE_URI', + 'APP_DEVELOPMENT_DATABASE_URI' + ] + for key in ENVIRONMENT_VARIABLES: + os.environ[key] = environ.get(key, '') + app = create_app(os.getenv('APP_CONFIG', 'production')) + return app(environ, start_response)