Parallelize downloads across hostnames and Django -


i want achieve speed load of images. don't know this, please read here.

is there django can me regarding this, in way ? i'm thinking how automatize url creation static content. i'm follow next pattern:

<script src="{{static_url}}scripts/jquery.js" type="text/javascript"></script> 

i first thought sequentially set static_url "http://cdnx.mydomain.com/", x numbers 1 4, break caching, because have no guaranty that, example, jquery served cdn2. or wrong ?

any ideas ?

you want custom template tag take care of looping, , store information in user's session. use cache backend this, you. may this:

last_cdn=4 cdn_format = "http://cdn%s.mydomain.com/%s" @register.simple_tag(takes_context=true) def cdn_url(context, url):     request = context['request'] ## assumes request in context.     current_cdn = request.session.get('current_cdn', 0)     current_cdn += 1     if current_cdn > last_cdn:         current_cdn=1     cdn_list = request.session.get('cdn_list', {})     if cdn_list.get(url, none) not none:         return cdn_format % (cdn_list.get(url), url,)     else:         cdn_list[url] = current_cdn         request.session['cdn_list'] = cdn_list     return cdn_format % (current_cdn, url,) 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -