我甚至不知道我尝试使用apache
和mod_wsgi
部署django应用程序有多少,但仍然会一次又一次地出现相同的错误,这是wsgi.py
文件:< / p>
"""
WSGI config for progress_bar project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/tone/entornos/progressbar/lib/python2.7/site-packages')
sys.path.append('/var/www/html/progress_bar/progress_bar')
sys.path.append('/var/www/html/progress_bar')
# Add virtualenv and activate for apache
activate_env=os.path.expanduser("/home/tone/entornos/progressbar/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "progress_bar.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
virtual-host
config:
<VirtualHost *:80>
#WSGIDaemonProcess python-path=/home/tone/entornos/progressbar/lib/python2.7/site-packages
#WSGIPythonPath /home/tone/entornos/progressbar/bin:/home/tone/entornos/progressbar/lib/python2.7/site-packages
WSGIScriptAlias /progress-django-upload /var/www/html/progress_bar/progress_bar/wsgi.py
<Directory /var/www/html/progress_bar>
Require all granted
</Directory>
</VirtualHost>
但总是我试图访问我有一个很好的错误500和日志说同样的:
[Fri Mar 13 13:19:12.427639 2015] [:error] [pid 4217] [client 150.214.108.153:50376] mod_wsgi (pid=4217): Target WSGI script '/var/www/html/progress_ba$
[Fri Mar 13 13:19:12.427799 2015] [:error] [pid 4217] [client 150.214.108.153:50376] mod_wsgi (pid=4217): Exception occurred processing WSGI script '/v$
[Fri Mar 13 13:19:12.427894 2015] [:error] [pid 4217] [client 150.214.108.153:50376] Traceback (most recent call last):
[Fri Mar 13 13:19:12.427981 2015] [:error] [pid 4217] [client 150.214.108.153:50376] File "/var/www/html/progress_bar/progress_bar/wsgi.py", line 24,$
[Fri Mar 13 13:19:12.428421 2015] [:error] [pid 4217] [client 150.214.108.153:50376] execfile(activate_env, dict(__file__=activate_env))
[Fri Mar 13 13:19:12.428567 2015] [:error] [pid 4217] [client 150.214.108.153:50376] IOError: [Errno 13] Permission denied: '/home/tone/entornos/progre$
[Fri Mar 13 13:19:14.450602 2015] [:error] [pid 4216] [client 150.214.108.153:50377] mod_wsgi (pid=4216): Target WSGI script '/var/www/html/progress_ba$
[Fri Mar 13 13:19:14.450722 2015] [:error] [pid 4216] [client 150.214.108.153:50377] mod_wsgi (pid=4216): Exception occurred processing WSGI script '/v$
[Fri Mar 13 13:19:14.450811 2015] [:error] [pid 4216] [client 150.214.108.153:50377] Traceback (most recent call last):
[Fri Mar 13 13:19:14.450889 2015] [:error] [pid 4216] [client 150.214.108.153:50377] File "/var/www/html/progress_bar/progress_bar/wsgi.py", line 24,$
[Fri Mar 13 13:19:14.451162 2015] [:error] [pid 4216] [client 150.214.108.153:50377] execfile(activate_env, dict(__file__=activate_env))
[Fri Mar 13 13:19:14.451249 2015] [:error] [pid 4216] [client 150.214.108.153:50377] IOError: [Errno 13] Permission denied: '/home/tone/entornos/progre$
在您回答之前......是的,我将chown -R apache:apache /home/tone/entornos/progressbar/bin
的apache权限设置为activate_this.py
到chomd 777 ...
,甚至暂时禁用SELinux,而且没有...总是一样的有权限......有人有这个问题的魔杖吗?
问候!
答案 0 :(得分:0)
最后sudo chmod -R 755 /home/tone
完成了工作!我不知道这样做是否是一个好习惯,只需授予所有组读取和执行整个主目录的权限,但是,现在这是一个很好的解决方法。