Django: Temporary "wait page" while heavy compute processing is handled

831 views
Skip to first unread message

Howard S

unread,
Aug 12, 2013, 12:28:35 AM8/12/13
to django...@googlegroups.com
Hi everyone,

I have a page whose content cannot be loaded until a lot of computations are done, which may take a minute or two. How can I set up a temporary "wait page" that will direct users to a new link once the computing is done?

For example:
User submits an input: http://127.0.0.1:8000/tools/submit/ 
User receives the output: http://127.0.0.1:8000/tools/result/

If such redirect is a bad practice, can should i do this via AJAX (which I am not very familiar with)?

Please and thank you.

Best,
Howard


Julio Molina Soler

unread,
Aug 12, 2013, 11:49:48 AM8/12/13
to django...@googlegroups.com
Hi Howard,

I'm not very experience with django yet, but if you are not very familiar with Ajax I recommend to have a look on jQuery, I also have no experience with Ajax, that's why I work with it, I find it more friendly, and get the things nicely done (mostly popup menus and so on). That link may help you
http://jqueryui.com/progressbar/

I hope someone can give you a better django approach, but I think the clean one would be via Ajax.

Julio

Nick Santos

unread,
Aug 12, 2013, 12:06:39 PM8/12/13
to django...@googlegroups.com
Hi Howard,

You will want to look into Celery, which lets you do heavy processing outside of your web requests. You can then use some checking via Javascript to see if the work is done yet and load a new page, or ask the user to come back later. There's a celery "app" for django that makes certain tasks a little easier. Sorry I can't provide more details than pointing you there right now, but I hope that helps. Someone on this list may have some better options for you that involve less setup, but Celery is the first thing that came to mind for me.

Also, just as an FYI, your links won't work because they point to your local development server and can't be accessed by anyone else.
-Nick



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

François Schiettecatte

unread,
Aug 12, 2013, 4:36:26 PM8/12/13
to django...@googlegroups.com
Hi

Another option is to email something with a link to a page where they can pick up their job results, you could easily generate a one-time token which can be inserted into a table and in the email as part of a url.

You could even you the same table as your job queue, rows missing their tokens still need to be processed, and you can check the url against the tokens for validity.

Finally you could also age out old rows at which point the tokens would be invalid.

François
Reply all
Reply to author
Forward
0 new messages