template rendering progress

21 views
Skip to first unread message

Philippe Raoult

unread,
Sep 19, 2012, 9:13:57 AM9/19/12
to django...@googlegroups.com
Hello all,

I'm using django templates to generate pdf listings in my app. After running render() on the template, reportlab is called to create the pdf.

My issue is that those listings can get quite big (hundreds of pages, with images) and thus take very long to render. Reportlab has progress callbacks that allow me to have a nice progress bar on screen, but the template rendering doesn't seem to offer this functionality. Has anyone managed to implement this or has any suggestion regarding this topic ?

Regards,
Philippe

Jani Tiainen

unread,
Sep 21, 2012, 1:37:46 AM9/21/12
to django...@googlegroups.com
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/kc5IlCznZ1wJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

You need to push your rendering task as "external" job. Celery is very
good at it and it does integrate with Django very well.

Basic idea is that you have view that starts the task and returns you
the progress view that is either refreshed by using meta-tag or quite
common ajax-approach to poll a view that returns progress value. And of
course some view to actually fetch the result.

But there is nothing in template engine that can offer this kind of
features since it's property of HTTP protocol and how request/response
cycle goes.

--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

Philippe Raoult

unread,
Sep 21, 2012, 4:05:55 AM9/21/12
to django...@googlegroups.com
Actually I'm already doing something similar. My question was more "how to know how far the rendering progress is". Right now I load a template and call render() on it but I don't have a way of knowing how much progress is made in real time.
Reply all
Reply to author
Forward
0 new messages