MEDIA_URL: Says what is the RELATIVE PATH to media files. So it is relative to the root dir in server. Used when referring links in templates. I.E: http://{{MEDIA_URL}}img/img.jpg. It has many other uses but the most important is the one before.
MEDIA_ROOT: Says what is the ABSOLUTE PATH to media files. So, it is relative to a LOCAL dir (in server or not). Used to say the exact dir (not relative to any server) where media is. I hope u to understand the difference better. Up Django! 2008/8/27 jgomo3 <[EMAIL PROTECTED]> > > I have no problem serving static content, but i'm still confused about > the MEDIA_ROOT and MEDIA_URL. > > Why the ROOT if i have the URL? > how do you actually use those variables? > > In production and in develpment server i havent used them, i simply > serve the statics content in some virtual server for that (avoiding > the use of django.views.static.serve becuase it force many changes > when passing thr project from the develpment server to apache). > > Are they used to avoid hard code the URL when referencing to things > like css? (example, to avoid 'href="http://example.com/css/site.css"' > and use 'href="http://%s/css/site.css' % MEDIA_URL). > If that then: > Why the MEDIA_ROOT? > For accessing the media files vie the filesystem on views or > someting? > If that then: > It is confusing the comment on the setting file in the variable > MEDIA_URL wich says "This URL handles the media served from > MEDIA_ROOT" because the media files accessed via the MEDIA_URL doesn't > have to be in the same machine. So, is intended that the two variables > refer to the same files? > > > -- ----------------------- Juan M.A.N. ----------------------- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

