On Fri, 2009-02-27 at 11:53 -0800, AKK wrote:
> Sorry I must mean the media url. Are the media_root and the media_url
> automatically linked? 

No. The MEDIA_ROOT (capitalisation is important) setting is a storage
path. It could be anywhere. It's then up to you to configure your
webserver so that requests to the MEDIA_URL URL pull files from the
right location (which will usually be MEDIA_ROOT).

The only dependency between MEDIA_ROOT and MEDIA_URL is that Django's
FileField (and its ImageField subclass) use MEDIA_ROOT to store the data
and return something based on MEDIA_URL when you request the URL for
that model field. However, configuring the two to be linked is up to you
(since there isn't any natural correspondence).


> In my settings.py i have:
> 
> C:/Program Files/Apache2.2/myproject/
> media/                             as the root &
> http://localhost:8080/akonline/media/
> as the url
> 
> and i have an image (imgs/img.jpg) in my C:/Program Files/Apache2.2/
> myproject/media/ but i get a 404 error when my template looks at this
> address:
> 
> http://localhost:8080/akonline/media/imgs/img.jpg
> 
> have i missed something?

As noted, you'll need to configure Apache to retrieve files from the
right location. Looking the Apache error logs will tell you where it's
looking right now when you query that URL. Looking in the Django
documentation (in particular, [1]) will tell you how to link things up.

[1] http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id1

By the way, don't be too scared by the strong recommendation to use an
entirely separate webserver for media files. That certainly not a bad
idea for really big sites, but using the same webserver works fine in a
lot of cases (Apache is very, very good at serving static files).

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to