From faa2882a73186818ba4664dca4a7488fe1a8956d Mon Sep 17 00:00:00 2001 From: Bob <1397910458@qq.com> Date: Thu, 20 Aug 2020 15:13:33 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=96=B0=E5=AA=92=E4=BD=93=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NewMediaMonitoring/local_settings.py | 48 ---------------------------- NewMediaMonitoring/wsgi.py | 11 +++++++ 2 files changed, 11 insertions(+), 48 deletions(-) delete mode 100644 NewMediaMonitoring/local_settings.py diff --git a/NewMediaMonitoring/local_settings.py b/NewMediaMonitoring/local_settings.py deleted file mode 100644 index 393eee4..0000000 --- a/NewMediaMonitoring/local_settings.py +++ /dev/null @@ -1,48 +0,0 @@ -import os - -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -DEBUG = True - -ALLOWED_HOSTS = ['*'] - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), -# } -# } -DATABASES = { - 'default': { - 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'newmediaDB1', - 'USER': 'newmedia', - 'PASSWORD': 'newmedia2020!@#', - 'HOST': '210.77.68.250', - 'PORT': '5432', - } -} -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), -# } -# } -STATIC_URL = '/static/' - -STATICFILES_DIRS = [ - os.path.join(BASE_DIR, "static"), -] -MEDIA_URL = '/static/upload/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'static/upload/') -import os -if os.name == 'nt': - import platform - OSGEO4W = r"C:\OSGeo4W" - if '64' in platform.architecture()[0]: - OSGEO4W += "64" - assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W - os.environ['OSGEO4W_ROOT'] = OSGEO4W - os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal" - os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj" - os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH'] diff --git a/NewMediaMonitoring/wsgi.py b/NewMediaMonitoring/wsgi.py index aca45d0..c7a4f01 100644 --- a/NewMediaMonitoring/wsgi.py +++ b/NewMediaMonitoring/wsgi.py @@ -8,10 +8,21 @@ https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os +import signal import sys +import time +import traceback from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NewMediaMonitoring.settings') sys.path.append("/var/www/p3/newmediamonitoring/current") application = get_wsgi_application() +try: + application = get_wsgi_application() +except Exception: + # Error loading applications + if 'mod_wsgi' in sys.modules: + traceback.print_exc() + os.kill(os.getpid(), signal.SIGINT) + time.sleep(2.5)