Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Jul 26, 2024
1 parent bbab57d commit 2b4c66b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions BookingSystem/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,18 @@ def debug_login() -> flask.Response:
return app


app = create_app()
# We need to create an app object for gunicorn to use with the routine tasks only running on the main thread, not the
# workers. But since gunicorn doesn't run on Windows we need to catch the exception and run the app normally
try:
if os.environ.get('TESTING', 'false').lower() == 'true':
raise Exception('Testing environment, skipping gunicorn')
import gunicorn.app.base


class App(gunicorn.app.base.BaseApplication):
def __init__(self):
start_routine()
self.options = {}
self.application = create_app()
self.application = app.wsgi_app
super().__init__()

def load_config(self):
Expand All @@ -162,7 +161,6 @@ def load(self):
except Exception as e:
logger.error(e)
start_routine()
app = create_app()

if __name__ == '__main__':
app.run(host='0.0.0.0')

0 comments on commit 2b4c66b

Please sign in to comment.