From df24ef6d707c4d0b4b220e4bd24e0609c103189d Mon Sep 17 00:00:00 2001 From: Mike Olund Date: Thu, 16 Mar 2017 22:42:40 -0700 Subject: [PATCH] Only run wsgi initialization once --- wsgi.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wsgi.py b/wsgi.py index dc176b36..9361ebd4 100644 --- a/wsgi.py +++ b/wsgi.py @@ -16,9 +16,13 @@ if not os.environ.get('OPENSHIFT_BUILD_NAMESPACE', False): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edivorce.settings.local") else: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edivorce.settings.openshift") - # compress the static assets - execute_from_command_line(['manage.py', 'compress', '--force']) - # load the Question fixture - execute_from_command_line(['manage.py', 'loaddata', '/opt/app-root/src/edivorce/fixtures/Question.json']) + + if os.environ.get('POD_INIT_COMPLETE', "") != "True": + # compress the static assets + execute_from_command_line(['manage.py', 'compress', '--force']) + # load the Question fixture + execute_from_command_line(['manage.py', 'loaddata', '/opt/app-root/src/edivorce/fixtures/Question.json']) + + os.environ["POD_INIT_COMPLETE"] = "True" application = get_wsgi_application()