Hi,

    I have this situation..

- We need to serve static files(images), lots of them, probably 100s
of them per second.

Our website is in Django and we need to support something like this:

1. a URL like /xyz.jpg should open an image.
2. image should be accesibe via this path only because we associate
some data while an image is served, viz number of hits, bandwidth
consumed, hits per second etc.

Prospects:
1. create something like cdn.sitename.com and on a hit to /xyz.png we
do something like

    def servefile ( request ):
        # save hit data
        return HttpResponseRedirect ( "http://cdn.sitname.com/images/
identifier.jpg" )
        # where identifier is some id for this image.

    (problem here is, users may directly start using the cdn version
of URL and we'll never know whats going on)

2. directly serve image, something like

    def servefile ( request ):
        # save hit data
        ofile = file ( os.path.join (settings.UPLOAD_DIR,
"identifier.jpg") )

        wrapper = FileWrapper ( file(ofile) )
        response = HttpResponse ( wrapper, content_type='image/jpg' )
        response['Content-Disposition'] = 'inline; filename=' +
uiImage.filerealname
        response['Content-Length'] = os.path.getsize(ofile)
        return response

    (problem here is:
     1. caching (which can be overcomed by methods like Etag and some
other ones)
     2. super slow. (this, on an Amazon EC2 normal instance cannot
past scale of 3-4images simultaneously :( ))


Please give me some good ways to do this.

Thanks and regards

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