我正在尝试用Apache部署我的Django项目,但是在3天之后,我无法弄清楚我的错误在哪里或我做错了什么。
我正在使用这个: Macbook Pro与OSX El Capitan 10.11.4 Python 2.7 Django 1.9.5 Apache 2.4.18
我在这条路径下有一个虚拟环境: 〜/站点/ EnvLimber
我在这条路径下有我的Django项目(这里是manage.py): 〜/站点/ EnvLimber /污水道
我已经用HomeBrew安装了mod_wsgi,而且我的python服务器运行得很好,使用python manage.py runserver。
该网站的网址是app.limber.com,当我到达那里时,我有这个输出:
如果我尝试/ login或/ admin我发现404 Not Found错误。
这是我的虚拟主机配置文件:
<VirtualHost *:80>
DocumentRoot "/Users/Mauricio/Sites/EnvLimber"
ServerName app.limber.com
ErrorLog "/Users/Mauricio/Sites/logs/app.limber.com-error_log"
CustomLog "/Users/Mauricio/Sites/logs/app.limber.com-access_log" common
<Directory "/Users/Mauricio/Sites/EnvLimber/limber">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
LogLevel info
ServerName app.limber.com
ServerAdmin maurigmorra@gmail.com
# Static files
DocumentRoot "/Users/Mauricio/Sites/EnvLimber/limber"
Alias /static/ /Users/Mauricio/Sites/EnvLimber/limber/static/
<Directory "/Users/Mauricio/Sites/EnvLimber/limber/static">
Order deny,allow
Allow from all
</Directory>
# WGSI configuration
WSGIDaemonProcess mysite.com processes=2 threads=15 display-name=%{GROUP} python-path=/Users/Mauricio/EnvLimber/Limber/:/Users/Mauricio/Sites/EnvLimber/lib/python2.7/site-packages
WSGIProcessGroup app.limber.com
WSGIScriptAlias / /Users/Mauricio/EnvLimber/limber/limber/wsgi.py
<Directory "/Users/Mauricio/EnvLimber/limber/limber">
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
</VirtualHost>
我将非常感谢您的帮助,我希望我的问题可以帮助更多人。 我为我的语法道歉,英语不是我的第一语言。
答案 0 :(得分:0)
您不应该有两个VirtualHost部分。将错误日志指令移动到第二部分,并完全删除第一部分。
答案 1 :(得分:0)
<强>解决!强>
<VirtualHost *:80>
ServerName app.limber.com
ServerAdmin maurigmorra@gmail.com
WSGIDaemonProcess / python-path=/Users/Mauricio/Sites/EnvLimber/limber:/Users/Mauricio/Sites/EnvLimber/lib/python2.7/site-packages
WSGIProcessGroup /
Alias /static /Users/Mauricio/Sites/EnvLimber/limber/static
<Directory /Users/Mauricio/EnvLimber/limber/limber/static>
Require all granted
</Directory>
WSGIScriptAlias / /Users/Mauricio/Sites/EnvLimber/limber/limber/wsgi.py
<Directory /Users/Mauricio/Sites/EnvLimber/limber>
Require all granted
</Directory>