On 3 April 2010 06:49, Enpaksh <enpa...@gmail.com> wrote: > Thanks this was my understanding. It looks like i have to route the url to > view and thn make a call urlopen().read() to fetch the file from different > server.
I'm not too sure how to do it with apache2, but can't you just proxy off any requests coming to http://mysite.com/media to your media server and let that handle it? There's no reason for media traffic to load into Django and make Django download the file and re-serve it. It's inefficient and silly. (Unless of course, you are using Django to modify the file, or for access control.) > Enpaksh Airon > Sent from my iPhone > > On Apr 2, 2010, at 3:20 PM, orokusaki <flashdesign...@gmail.com> wrote: > >> On Apr 2, 11:30 am, Dexter <a.essel...@gmail.com> wrote: >>> >>> Hi, >>>> >>>> Can someone please >>>> explicitly specify what needs to go in MEDIA_URL and MEDIA_ROOT and >>>> how does urls.py routes to a cross domain media server. I am not >>>> interested in any local directory structure to accomplish this task >>>> because that is insecure and inefficient. Any help would be >>>> appreciated. >> >> >> It doesn't do what you're thinking it does. ``settings.MEDIA_ROOT`` >> tells Django where the media is going to be stored if you use Django's >> storage API for uploads, etc. ``settings.MEDIA_URL`` is what you use >> to generate URLs for media (eg, ``<img src="{{ MEDIA_URL }}/logo.jpg" >> alt="Logo" />``). Django doesn't take the two settings and some how >> magically route incoming traffic on ``settings.MEDIA_URL`` and route >> it to ``settings.MEDIA_ROOT``, and certainly not when your media is on >> a separate server, and you're right, that would be insecure to do. If >> you want to server static media from the same server during dev, you >> could do something like this: >> >> >> if settings.DEBUG: >> urlpatterns += patterns('', >> # Static Media (development only) >> url(r'^static/(?P<path>.*)$', >> 'django.views.static.serve', >> { >> 'document_root': 'C:/path/to/my_media' >> } >> ) >> ) >> >> >> Then your media could be served via http://localhost:8080/static/logo.jpg >> >> Remember to only do this during dev as it's not secure or scalable. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@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. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.