python - Django Apache mod_wsgi 权限错误

标签 python django apache mod-wsgi

已在 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/

相关文章:

javascript - Highcharts 导入在 Django 中正确加载 - Python

linux - 为什么我的干净 URL 在 Drupal 中不起作用,即使 rewrite_module 存在?

apache - 在Dockerfile中重启是否有意义?

php - 运行时如何显示代码错误

c++ - 计算机视觉 : Image Comparison and Counting?

python - 带权重的 Scikit-Learn 分类和回归

django - 如何在 Django 中获取上传的 zip 文件并保存其内容(mp3 文件)?

python - django 和 dropzone 如何发布表单

python - 如何从 python 中的元素列表中删除特殊字符?

python - googlevoice 不会以编程方式登录 (Python)