diff --git a/application.py b/application.py index 875f2aab4..c674e7ae6 100644 --- a/application.py +++ b/application.py @@ -2,11 +2,6 @@ from __future__ import print_function -from gevent import monkey - -monkey.patch_all() # this has to be called before other imports or monkey patching doesn't happen - - from flask import Flask # noqa from werkzeug.serving import WSGIRequestHandler # noqa diff --git a/gunicorn_entry.py b/gunicorn_entry.py new file mode 100644 index 000000000..ab9a0d526 --- /dev/null +++ b/gunicorn_entry.py @@ -0,0 +1,5 @@ +from gevent import monkey + +monkey.patch_all() + +from application import application # noqa diff --git a/scripts/migrate_and_run_web.sh b/scripts/migrate_and_run_web.sh index 3e39dceb6..ed999a24e 100755 --- a/scripts/migrate_and_run_web.sh +++ b/scripts/migrate_and_run_web.sh @@ -4,4 +4,4 @@ if [[ $CF_INSTANCE_INDEX -eq 0 ]]; then flask db upgrade fi -exec newrelic-admin run-program gunicorn -c ${HOME}/gunicorn_config.py application +exec newrelic-admin run-program gunicorn -c ${HOME}/gunicorn_config.py gunicorn_entry:application