我正在尝试使用 mod_wsgi(在 apache 上)设置 django。它给出了这个错误:
尝试提供目录:/home/mysite/products/templates/
httpd.conf:
ServerRoot "/home/mysite"
<Location "/">
SetHandler python-program
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonPath "['/home/','/home/mysite/'] + sys.path"
PythonDebug Off
</Location>
django.wsgi(放在文件夹/home/mysite/public_wsgi):
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
path = '/home/mysite/'
if path not in sys.path:
sys.path.append(path)
虚拟主机:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /home/mysite/products/templates
WSGIScriptAlias /wsgi /home/mysite/public_wsgi
Alias /static/ /home/mysite/products/static/
Alias /robots.txt /home/mysite/products/templates/robots.txt
Alias /favicon.ico /home/mysite/products/static/images/favicon.ico
<Directory /home/mysite/products/static>
Order deny,allow
Allow from all
</Directory>
<Directory />
Options FollowSymLinks
Options Indexes
DirectoryIndex /home/mysite/products/templates/home.html
AllowOverride None
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
似乎无法弄清楚问题所在。我该如何解决这个错误?对此的任何帮助都会很棒。谢谢