static files avec mod_wsgi
Bonjour,
je continue mon post précédent mais comme ça n'avait plus grand chose à voir avec cgi j'en fait un nouveau.
Je n'arrive pas à faire fonctionner les css, images,... sur mon site.
J'ai donc modifié mon /etc/httpd/conf/httpd.conf
dont le passage le plus intéressant est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| 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
AliasMatch /([^/]*\.css) /home/mart/programmation/python/django/martfiles/media/css/$1
Alias /media /home/mart/programmation/python/django/martfiles/media/
<Directory /home/mart/programmation/python/django/martfiles/>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /srv/http/wsgi-scripts/django.wsgi
<Directory /home/mart/programmation/python/django/wsgi-scripts/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost> |
le fichier /srv/http/wsgi-script/django.wsgi est celui récupéré dans la doc adapté à mon cas.
Au début j'avais essayé en le mettant dans un dossier dans mon home mais bizarrement ça ne fonctionnait pas (cf post précédent)
voici comment sont structurés mes dossiers et fichiers plus permissions
Citation:
/src/http/ :
drwxr-xr-x 3 root devusers
-- wsgi-scripts/ :
drwxr-xr-x 2 root devusers
-- --
django.wsgi :
-rwxrwxr-x 1 root devusers
/home/mart/programmation/python/django/ :
drwxrwxr-x 8 root devusers
-- martfiles/ :
drwxrwxr-x 5 root devusers
-- -- __init__.py :
-rwxrwxr-x 1 root devusers
-- -- manage.py :
-rwxrwxr-x 1 root devusers
-- -- media/ :
drwxrwx--x 3 root devusers
-- -- -- css/ :
drwxrwxr-x 2 root devusers
-- -- -- -- style.css :
-rwxrwxr-x 1 root devusers
-- --
settings.py :
-rwxrwxr-x 1 root devusers
-- -- templates/ :
drwxrwx--x 3 root devusers
-- -- urls.py :
-rwxrwxr-x 1 root devusers
-- -- views.py :
-rwxrwxr-x 1 root devusers
le groupe devusers à comme membre
Code:
1 2 3
| # cat /etc/group
...
devusers:x:121:mart,http,root |
j'appelle le fichier css dans mon template base.html comme ceci
Code:
1 2 3
| <html>
<head>
<link rel="stylesheet" href="/media/css/style.css" /> |
j'ai essayé avec href="/style.css" mais ça donne le même résultat
et j'ai dans /var/log/http/error.log
Code:
1 2
| [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 '' |
merci
ps : je suppose que le problème est similaire à pour le fichier django.wsgi, si je les mettais dans le dossier apache ça marcherait