已在 virtualenv 中设置 Django,但出现 500 Internal Server Error。开发服务器运行良好。
环境:
- python 2.7.12
- Apache 2.4.23
- Django 1.10
- 软呢帽 24
服务器日志:
[Mon Aug 29 12:27:49.364393 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364552 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364904 2016] [wsgi:error] [pid 19157] (13)Permission denied: [remote 14.2.108.225:1832] mod_wsgi (pid=19157, process='motorable', application='ip-172-31-22-170.ap-southeast-2.compute.internal|'): Call to fopen() failed for '/home/fedora/motorable/motorable/wsgi.py'.
配置:
Alias /static /home/fedora/motorable/static
<Directory /home/fedora/motorable/static>
Require all granted
</Directory>
<Directory /home/fedora/motorable/motorable>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess motorable python-path=/home/fedora/motorable:/home/fedora/mot$
WSGIProcessGroup motorable
WSGIScriptAlias / /home/fedora/motorable/motorable/wsgi.py
WSGISocketPrefix /var/run/wsgi
WSGI 以守护进程模式运行,我尝试添加 WSGISocketPrefix
指令,但我不确定还需要检查或做什么。第一次在这里试验 Django。用户主目录是710,应该允许Apache进入,我将apache用户添加到fedora的主要组。
谁能分享一些见解?
最佳答案
将项目移到主目录之外的/var/www/django 解决了我的问题。
关于python - Django Apache mod_wsgi 权限错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39206968/