Absolutely not. You're thinking of everything from a "how does it
relate to my python program" standpoint. Using a media server has
nothing to do with django from a programming stand point. Python is a
great language but urlopen.read() is certainly not sufficient for
handling your media requests. You should be thinking of 3 things:

1) what is the best media server (speed and resource usage-wise, it's
Nginx, bit lighthttpd, and apache will fit the bill)

2) how can I organize files in a way that works well with my data
model (eg, /public/user-files/tom/, or whatever) so that my media URLs
make sense (eg, http://media.example.comuser-files/tom/logo.jpg).

3) how can I get my files from the application server to the media
server when users upload them. If you put it on the same physical
server, this is easy. You can easily run a medium priduction site, and
a media server on a single server. If it's on another server across
the room, you might as well use something like Python's builtin FTP
library to move them.


On Apr 2, 1:49 pm, 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.
>
> 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 viahttp://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 
> > athttp://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.

Reply via email to