我正在尝试使用 mod-wsgi 在 apache 服务器上将 Django 应用程序部署到生产环境中。mod-wsgi 已安装并运行良好。当我运行 Django 服务器时,它可以正常启动,但我无法在服务器上或在线访问它,我不明白为什么。我发布了ports.conf
(针对 apache)的相关部分,以及我的wsgi.py
(创建项目时自动生成为 pinax.wsgi,重命名为 wsgi.py,这不会影响任何内容)脚本。
端口.conf:
<VirtualHost *:80>
ServerName <myserver>.org
WSGIDaemonProcess mysite python-path=/<myapp>-env/pinax-env/lib/python2.5/site-packages
WSGIProcessGroup mysite
WSGIScriptAlias / /<myapp>/deploy/wsgi.py
<Directory /<myapp>/deploy>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
wsgi.py
# pinax.wsgi is configured to live in projects/<myapp>/deploy.
import os
import sys
from os.path import abspath, dirname, join
from site import addsitedir
sys.path.insert(0, abspath(join(dirname(__file__), "../../")))
From django.conf import settings
os.environ["DJANGO_SETTINGS_MODULE"] = "<myapp>.settings"
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()