diff options
Diffstat (limited to 'src/far_edge_ops_api/wsgi.py')
| -rw-r--r-- | src/far_edge_ops_api/wsgi.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/far_edge_ops_api/wsgi.py b/src/far_edge_ops_api/wsgi.py index 3b5d6a6..7f9b679 100644 --- a/src/far_edge_ops_api/wsgi.py +++ b/src/far_edge_ops_api/wsgi.py @@ -6,11 +6,27 @@ It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ - import os - +import sys from django.core.wsgi import get_wsgi_application +from django.conf import settings +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.append(BASE_DIR) +sys.path.append("%s../static/" % BASE_DIR) +sys.path.append("%s/../../venv/lib/python3.6/site-packages" % BASE_DIR) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'far_edge_ops_api.settings') -application = get_wsgi_application() +if settings.DEBUG: + application = get_wsgi_application() +else: + import time + import traceback + import signal + try: + application = get_wsgi_application() + except Exception: + if "mod_wsgi" in sys.modules: + traceback.print_exc() + os.kill(os.getpid(), signal.SIGINT) + time.sleep(2.5) |
