On 05/01/06 22:51, tgone wrote:
> 
> Steven Armstrong wrote:
>> On 05/01/06 22:36, tgone wrote:
>> > Hello,
>> >
>> > I followed the tutorial on how to serve static files with
>> > Apache+mod_python but I'm still having problems. I get a 404 when I try
>> > to access an image at http://localhost/project/media/test.png. I know
>> > for sure that mod_python is disabled for the /media/ dir, but I can't
>> > get the images to display.
>> >
>> > Here is my httpd.conf:
>> >
>> > ----------------------------------------------------------------------------------------------------
>> > <Location "/project">
>> >     SetHandler python-program
>> >     PythonHandler django.core.handlers.modpython
>> >     PythonPath "['/home/webadmin'] + sys.path"
>> >     SetEnv DJANGO_SETTINGS_MODULE project.settings
>> >     PythonDebug On
>> > </Location>
>> >
>> > <Location "/project/media/">
>> >     SetHandler None
>> > </Location>
>> > ----------------------------------------------------------------------------------------------------
>> >
>> > Here is my settings.py
>> > ----------------------------------------------------------------------------------------------------
>> > MEDIA_ROOT = '/home/webadmin/project/media/'
>> > MEDIA_URL = 'http://localhost/project/media/'
>> > ADMIN_MEDIA_PREFIX = '/project/media/'
>> > ----------------------------------------------------------------------------------------------------
>> >
>> > I've double checked my MEDIA_ROOT and my image is there.
>> >
>>
>> You haven't told Apache where your media folder is.
>>
>> Try something like:
>>
>> Alias /project/media /home/webadmin/project/media/
>> <Directory /home/webadmin/project/media>
>>    SetHandler None
>> </Directory>
>>
>> hth
> 
> yes! thank you.
> 
> I didn't see that info mentioned on
> http://www.djangoproject.com/documentation/modpython/#serving-media-files.
> Maybe it's assumed, but I'm new to Apache.
> 

Yea, looks like the docs are a bit unclear/incomplete there.

<Location> is only really usefull for mapping urls to applications.

As soon as you're addressing static resources that are somewhere on the 
filesystem it's better to use <Directory>. If the resource lives outside 
your apaches DocumentRoot you also need an Alias to link it in.

cheers

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to