Hi, You can use django.views.static.serve. In my application I have the following link in my urls.py
(r'^css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '%s/templates/css' % APPLICATION_ROOT }), (r'^javascript/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '%s/templates/javascript' % APPLICATION_ROOT }), (r'^images/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '%s/templates/images' % APPLICATION_ROOT}), (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '%s/media' % APPLICATION_ROOT}), Where APPLICATION_ROOT is the physician path to my Django application. And when I want to access to image file, I use the following link: / images/image_name.jpg. Regards, Marcin On Nov 20, 4:04 pm, idioglossiahh <[EMAIL PROTECTED]> wrote: > Hi everybody, > There are lots of discussions on the internet concerning this topic - but I > couldn't find any information that helped me. I know that this is not > > necessarily a Django topic but perhaps there are more people here who find > this information helpful. > > I am trying to get my Djano project to run on Apache with mod_python. > Everything works fine - but static content like images and css files is not > > displayed/loaded properly. > > My directory structure looks like this: > /home/websites/mydomain (root directory of my Django application) > /home/websites/mydomain/static/images (dir for images) > /home/websites/mydomain/static/css (dir for css files) > > At the end of my httpd.conf file I have added this: > > DocumentRoot "/home/websites/mydomain" > > <Location "/"> > SetHandler python-program > PythonPath "['/home/websites'] + sys.path" > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mydomain.settings > SetEnv PYTHON_EGG_CACHE /tmp/egg-cache > PythonDebug On > AuthType Basic > AuthName "Administration" > AuthUserFile /usr/admin/web/.htusers > Require valid-user > </Location> > > <LocationMatch "\.(jpg|gif|png)$"> > SetHandler None > </LocationMatch> > > <Location "/static"> > SetHandler None > </Location> > > But if I call this url in my > browser:http://www.mydomain.com/static/images/image.jpg > > I just see standard "Page not found (404)" error page generated by Django. > Which is quite strange because the settings in my httpd.conf say that images > > and static content should NOT be handled by Python/Django. > > Any hints for me? I'm using Apache 2.2.0 and mod_python 3.1.3 > -- > View this message in > context:http://www.nabble.com/Django---Apache-Problem-%28ignores-SetHandler%2... > Sent from the django-users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---