Sunday, November 11, 2012
streaming-a-csv-file-in-django , stream-an-httpresponse-with-django
django return response large
1
Send large files through Django, and how to generate Zip files
http://djangosnippets.org/snippets/365/
2
django stream file in response
http://stackoverflow.com/questions/5146539/streaming-a-csv-file-in-django
MAIN CSV in-memory file csv writer.
3
Piston is a relatively small Django application that lets you
create application programming interfaces (API) for your sites.
https://bitbucket.org/jespern/django-piston/wiki/Home
https://bitbucket.org/jespern/django-piston/src/c4b2d21db51a/piston/middleware.py
4
http://stackoverflow.com/questions/2922874/how-to-stream-an-httpresponse-with-django
from django.views.decorators.http import condition
@condition(etag_func=None)
def stream_response(request):
resp = HttpResponse( stream_response_generator(), mimetype='text/html')
return resp
def stream_response_generator():
yield "<html><body>\n"
for x in range(1,11):
yield "<div>%s</div>\n" % x
yield " " * 1024 # Encourage browser to render incrementally
time.sleep(1)
yield "</body></html>\n"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment