我已经安装了 apache 和 mod_wsgi,所有的网页都被检索和显示了,但是当我尝试访问一个静态文件(例如:http://localhost/static/css/base. css)它说我无权访问该文件,媒体文件也是如此。所以基本上返回的网页只是纯 HTML。
我已按照演示幻灯片http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-pycon-sydney-2010.pdf中的步骤操作,并通过chmod o+rx /home/loai/workspace/Faculty
我的 httpd 让其他人可以访问这些目录。 conf部分是:
WSGIScriptAlias / /home/loai/workspace/Faculty/Faculty/wsgi.py
WSGIPythonPath /home/loai/workspace/Faculty
Alias /media/ /home/loai/workspace/Faculty/Faculty/media
Alias /static/ /home/loai/workspace/Faculty/Faculty/static
<Directory /home/loai/workspace/Faculty/Faculty/static>
Order deny,allow
Allow from all
</Directory>
<Directory /home/loai/workspace/Faculty/Faculty/media>
Order deny,allow
Allow from all
</Directory>
<Directory /home/loai/workspace/Faculty/Faculty>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
奇怪的是,当我删除“文件”指令时,它变成:
<Directory /home/loai/workspace/Faculty/Faculty>
Order deny,allow
Allow from all
</Directory>
instead of
<Directory /home/loai/workspace/Faculty/Faculty>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
然后尝试访问任何静态或媒体文件引发(未找到)而不是权限被拒绝!但仍然加载了纯 html 页面!