Django Apache mod_wsgi 与 Wordpress 共存无法建立数据库连接

Django Apache mod_wsgi co existing with Wordpress cannot establish database connection

我正在尝试在具有 Apache 和 Wordpress 的 Centos 服务器上部署 Django 应用程序。 该应用程序在开发服务器中使用 django 构建没有问题,但是当我尝试使用 mod_wsgi 进行部署时,我收到错误消息:建立数据库时出错 connection.My 猜测是它与配置文件,它尝试 运行 使用 wordpress 而不是 mod_wsgi 的应用程序,这就是我收到此 wordpress 错误的原因,但我一直在尝试并搜索如何解决此问题,但我没有找到解决方案。

我的配置文件是 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 运行ning 在 '/' 有冲突 我已经尝试对配置文件进行许多更改,但没有成功。 有没有人有任何建议我遗漏了什么以及可能有什么问题?

谢谢。

已解决!看来 mysql-community removed.And 必须重新安装它。 安装后 mysql 一切正常。