2017-01-19 61 views
0

我試圖在具有Apache和Wordpress的Centos服務器上部署Django應用程序。 該應用程序與開發服務器中的django構建工作沒有問題,但當我嘗試與mod_wsgi部署我得到一個錯誤:建立數據庫連接時出錯。我猜是它與配置文件有關,它會嘗試運行應用程序使用wordpress而不是mod_wsgi,這就是爲什麼我得到這個WordPress的錯誤,但我一直在嘗試和尋找如何解決這個問題,我已經無法解決。Django與Wordpress存在的Apache mod_wsgi co無法建立數據庫連接

我的配置文件是在conf.d 2個獨立的文件:

django.conf:

Alias /static/ /root/mass_update/static/ 


<Directory /root/mass_update/static> 
Require all granted 
</Directory> 



WSGIScriptAlias /mass_update /root/mass_update/dashboard/wsgi.py 


<Directory /root/mass_update/dashboard> 
<Files wsgi.py> 
Require all granted 
</Directory> 

#WSGIPythonPath /var/www/mass_update/:/root/.virtualenvs/dashboard/lib/python2.7/site-packages 

WSGIDaemonProcess mass_update python-path=/root/mass_update:/root/.virtualenvs/dashboard/lib/python2.7/site-packages 
WSGIProcessGroup mass_update 

idash.conf(WordPress的):

<VirtualHost 172.31.128.20:80> 
#  ServerAlias test 

     DocumentRoot /var/www/idash 
     ServerName idash.test.gr 
     <Directory /var/www/idash> 
       AllowOverride All 
     </Directory> 
</VirtualHost> 

settings.py:

""" 
Django settings for dashboard project. 

For more information on this file, see 
https://docs.djangoproject.com/en/1.7/topics/settings/ 

For the full list of settings and their values, see 
https://docs.djangoproject.com/en/1.7/ref/settings/ 
""" 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
import os 
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 


# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = False 

TEMPLATE_DEBUG = False 

ALLOWED_HOSTS = ['*'] 


# Application definition 

INSTALLED_APPS = (
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'mass_update', 
    'smart_selects', 
    'widget_tweaks', 
) 

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
) 

ROOT_URLCONF = 'dashboard.urls' 

WSGI_APPLICATION = 'dashboard.wsgi.application' 


# Database 
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.oracle', 
     'NAME': 'test', 
    'USER': 'test', 
    'PASSWORD': 'tes', 
    'HOST': 'host_ip', 
    'PORT':'host_port', 
    } 
} 

# Internationalization 
# https://docs.djangoproject.com/en/1.7/topics/i18n/ 

LANGUAGE_CODE = 'en-us' 

TIME_ZONE = 'UTC' 

USE_I18N = True 

USE_L10N = True 

USE_TZ = True 


# Static files (CSS, JavaScript, Images) 
# https://docs.djangoproject.com/en/1.7/howto/static-files/ 

STATIC_ROOT = 'static/' 

STATIC_URL = '/static/' 

Django連接到oracleDB。 我也使用'/'作爲WSGIScript別名,並得到一個500錯誤猜測與wordpress運行在'/'我試過很多配置文件沒有運氣的變化。 有沒有人有任何建議我錯過了什麼,什麼可能是錯的?

謝謝。

回答

0

解決!似乎mysql的社區刪除,並不得不重新安裝它。 安裝完mysql後,一切正常。