我想在一臺服務器上部署多個Django項目。 它是Windows 32位Xampp。 mod_wsgi是32位。 python是32位。 Django是1.7.3版本。在一個Xampp Windows Apache Mod_WSGI服務器上部署兩個Django項目
我讀過很多帖子,並嘗試了很多東西,但我無法克服這個問題。
瀏覽器中顯示的以下錯誤還表示某些版本信息。
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
Error 500
localhost Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19 mod_wsgi/3.5 Python/2.7.6
我可以用這種方法成功部署一個django應用程序。如果我只部署一個,例如: c:/ p2/xampp/htdocs/django/mysite
當我添加第二個項目時,出現以下錯誤,只有第一個項目有效。
我在apache error.log中出現以下錯誤。
mod_wsgi (pid=11184): Exception occurred processing WSGI script 'C:/p2/xampp/htdocs/django/apache/django161c.wsgi'.
~~~~~ some lines removed ~~~~~~
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named mysite.settings
我的httpd.conf中的最後兩行:
LoadModule wsgi_module modules/mod_wsgi.so
Include C:/p2/xampp/htdocs/django/apache/wsgi3.conf
我wsgi3.conf
############
listen 8986
<VirtualHost *:8986>
Alias /static/ c:/p2/xampp/htdocs/django/mysite/static/
WSGIScriptAlias/"c:/p2/xampp/htdocs/django/apache/mysite.wsgi"
DocumentRoot "c:/p2/xampp/htdocs/django/mysite"
ServerName 127.0.0.1
<Directory "c:/p2/xampp/htdocs/django/apache">
Allow from all
</Directory>
</VirtualHost>
############
listen 8985
<VirtualHost *:8985>
WSGIScriptAlias/"c:/p2/xampp/htdocs/django/apache/django161c.wsgi"
DocumentRoot "c:/p2/xampp/htdocs/django/django161c"
ServerName 127.0.0.1
<Directory "c:/p2/xampp/htdocs/django/apache">
Allow from all
</Directory>
</VirtualHost>
我mysite.wsgi:
import os, sys
sys.path.append('c:/p2/xampp/htdocs/django/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
# works: https://www.pythonanywhere.com/forums/topic/1629/ # this is for changes to django 1.7 # 2015-01-23_Fri_14.13-PM
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
我django161c.wsgi
import os, sys
sys.path.append('c:/p2/xampp/htdocs/django/django161c')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
你能幫助我嗎?