我搜索了很多,但我仍然有與我的django網站的靜態文件(CSS,圖像,...)的問題。靜態文件與Django中的mod_wsgi
我使用的mod_wsgi和Apache上的archlinux 64位
我在我的http.conf加入它:
LoadModule wsgi_module modules/mod_wsgi.so
<VirtualHost *:80>
WSGIDaemonProcess mart.localhost user=mart group=users processes=2 threads=25
WSGIProcessGroup mart.localhost
LogLevel debug
Alias /media /home/mart/programmation/python/django/martfiles/media/
<Directory /home/mart/programmation/python/django/martfiles/>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias//srv/http/wsgi-scripts/django.wsgi
</VirtualHost>
我試圖用django.wsgi在我的主文件夾,但它不工作(permission denied to access /
)(奇怪的是它的工作原理,如果我用給here測試腳本)
所有的目錄和內容(阿帕奇文件夾,WSGI腳本,martfiles)與本集團devuse許可775 root:devusers
RS包括我的用戶,HTTP和根
在我的模板base.html文件,我稱之爲CSS是這樣的:
<html> <head>
<link rel="stylesheet" href="/media/css/style.css" />
和/var/log/http/error.log
錯誤[Sat Jan 16 13:22:21 2010] [error] [client 127.0.0.1] (13)Permission denied: access to /media/css/style.css denied, referer: http://localhost/
[Sat Jan 16 13:22:21 2010] [info] mod_wsgi (pid=14783): Attach interpreter ''
/srv/http/wsgi-script/django.wsgi
/home/.../martfiles/settings.py
謝謝
編輯:我準確的,我的Django的網站工作正常(會議除外,但我不認爲這是相關的),所以我不知道它是關係到django.wsgi文件(也許我錯了),但肯定的是,我應該可以,如果我改線Alias /media /home/mart/programmation/python/django/martfiles/media/
使用django.wsgi從Apache文件夾
外側Alias /media /srv/http/media/
並給出正確的權限,有用。但我不希望(也不應該)把我的所有媒體放在apache文件夾中
這就是爲什麼我給了775權限包含我的apache用戶(HTTP)的組devusers。哪裏和哪個許可?我來試試 – 2010-01-17 06:32:29
我把我的媒體在/ usr /共享/ Django的只有root權限和它的作品!非常感謝 – 2010-01-17 10:53:54
+1修復我的錯誤。將家庭權限設置爲755的安全含義是什麼? – g33kz0r 2010-03-27 20:21:06