Apache / Django / mod_wsgi-[Errno 13]权限被拒绝:

问题描述 投票:1回答:1

[我正在使用Django + Apache + mod_wsgi,并定义了两个应用程序:一个测试-pollsforecast

[当我尝试从Django服务器访问index.html应用程序的forecast(主)页面时突然遇到问题-我得到了错误

拒绝权限

最初,一切正常,我没有发现我犯的错误。要提及的是,访问位于相同项目和目录polls中的myproject应用程序可以正常工作。

===error 'forecast' app ====
[Errno 13] Permission denied: '/home/florian/workdev/myproject/upload/index.html'
Request Method:     GET
Request URL:    http://localhost:8000/forecast/
Django Version:     2.1.4
Exception Type:     PermissionError
Exception Value:    

[Errno 13] Permission denied: '/home/florian/workdev/myproject/upload/index.html'

Exception Location:   /home/florian/workdev/venv/lib/python3.5/site-packages/django/template/loaders/filesystem.py in get_contents, line 23
Python Executable:  /home/florian/workdev/venv/bin/python
Python Version:     3.5.2
Python Path:    

['/home/florian/workdev/myproject',
 '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/home/florian/workdev/venv/lib/python3.5/site-packages']

Server time:  Wed, 19 Dec 2018 18:57:44 +0000
python django permission-denied
1个回答
0
投票

我使用的是Apache + flask + mod_wsgi,并且由于wsgi [错误13]权限被拒绝而面临类似的问题。发生这种情况是因为我没有在apache2.conf文件中为WSGIDaemonProcess和WSGIProcessGroup配置用户权限。为了解决这个问题,我做了类似的事情

<VirtualHost *:80>
ServerName www.site1.com
CustomLog logs/www.site1.com-access_log common
ErrorLog logs/ww.site1.com-error_log

WSGIDaemonProcess www.site1.com user=joe group=joe processes=2 threads=25
WSGIProcessGroup www.site1.com

...
</VirtualHost>

<VirtualHost *:443>
ServerName www.site2.com
CustomLog logs/www.site2.com-access_log common
ErrorLog logs/www.site2.com-error_log

WSGIDaemonProcess www.site2.com user=bob group=bob processes=2 threads=25
WSGIProcessGroup www.site2.com

...
</VirtualHost>

请参考此文档以获取更多详细信息Doc

© www.soinside.com 2019 - 2024. All rights reserved.