我已经使用apache和mod_wsgi将示例Django应用程序配置为virtualenv。该应用程序将在centos服务器上运行。
但是,当我将settings.py文件更改为mysql设置时,我收到了500内部错误。
日志
[wsgi:error] [pid 11556] Traceback (most recent call last):
[wsgi:error] [pid 11556] File "/var/www/django/mysite/mysite/wsgi.py", line 35, in <module>.
[wsgi:error] [pid 11556] application = get_wsgi_application().
[wsgi:error] [pid 11556] File "/var/www/django/mysite/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application.
[wsgi:error] [pid 11556] django.setup(set_prefix=False).
[wsgi:error] [pid 11556] File "/var/www/django/mysite/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[wsgi:error] [pid 11556] apps.populate(settings.INSTALLED_APPS).
[wsgi:error] [pid 11556] File "/var/www/django/mysite/lib/python3.6/site-packages/django/apps/registry.py", line 81, in populate
[wsgi:error] [pid 11556] raise RuntimeError("populate() isn't reentrant")
[wsgi:error] [pid 11556] RuntimeError: populate() isn't reentrant
settings.py
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'test_user',
'PASSWORD': 'password_test',
'HOST': '192.168.0.1',
'PORT': '3306',
}
}
在服务器上运行以下命令本身不会显示任何错误
python manage.py runserver
但是,当通过mod_wsgi部署它时,会显示上述错误。
帮助表示赞赏。谢谢!