I have a django web application running on our apache2 production server using mod_python, but no static files are found (css,images ... )
All our static stuff is under /var/my.site/example/static
/var/my.site/example/static/
|-admin/
|-css/
|-img/
|-css/
|-js/
|-img/
Now I thought I just could alias all requests to my static stuff like so:
This is the apache2 conf:
<VirtualHost 123.123.123:443>
... SSL stuff ...
RewriteEngine On
ReWriteOptions Inherit
<Location "/example">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE example.settings
PythonPath "[ \
'/home/me/Envs/ex/lib/python2.6/site-packages',\
'/var/my.site',\
'/home/me/Envs/ex/lib/python2.6/site-packages/django',\
'/home/me/Envs/ex/lib/python2.6/site-packages/MySQLdb',\
'/var/my.site/example',\
'/var/my.site/example/static'] + sys.path"
PythonDebug Off
</Location>
Alias /example/static /var/my.site/example/static
<Directory /var/my.site/example/static>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This is my settings.py
...
STATIC_ROOT = '/var/my.site'
STATIC_URL = '/example/static/'
STATICFILES_DIRS = (
"/var/my.site/example/static",
)
...
There is no errors in the apache-error log. But here log from apache-secure_access.log
[09/Aug/2012:12:37:55 +0200] "GET /example/admin/ HTTP/1.1" 200 6694
[09/Aug/2012:12:37:55 +0200] "GET /example/static/css/base.css HTTP/1.1" 301 468
[09/Aug/2012:12:37:55 +0200] "GET /example/static/img/logo.png HTTP/1.1" 403 766
[09/Aug/2012:12:37:55 +0200] "GET /example/static/css/base.css/ HTTP/1.1" 500 756
[09/Aug/2012:12:37:55 +0200] "GET /example/static/admin/css/dashboard.css HTTP/1.1" 301 622
But this doesn't work and I'm not sure, if I even, is on the right track. It does work when I set DEBUG = True But that's just because django serves all the static files.
What am I doing wrong?
Does anyone know about a good tutorial or example?