0

I have build an application outside of Django which i would like to interact with Django. So within a view in Django i would like to start and stop this application. While the application is running it will return a JSON string which has to be pushed back to the view and processed client-side with JavaScript. The application is pretty much blocking as it is a while-loop running until it has been killed.

It is very important to stress that this is an experimental project and wont be used in production, so it has to work and nothing more than that as i intend to use this for one demonstration.

So to sum it up, i want to (1) start the application from the view, (2) the application runs and returns JSON values to the view and (3) at any given time i should be able to kill the application (while-loop in this case).

Another option is to use for example Tornado, but it seems very comprehensive for such a simple test..

JavaCake
  • 4,075
  • 14
  • 62
  • 125

1 Answers1

1

Have you tried django-celery?

laike9m
  • 18,344
  • 20
  • 107
  • 140
  • Can it handle a task returning numerous times? – JavaCake Oct 02 '14 at 13:06
  • @JavaCake I haven't used celery for returning numerous times so honestly speaking I don't know. But since the return value varies over time, why don't you just create a new task every time? – laike9m Oct 02 '14 at 14:11
  • the reason for this is because i'm running a genetic algorithm which is looping up to 20minutes. But perhaps i am forced to save the results in a database instead. – JavaCake Oct 02 '14 at 14:21
  • @JavaCake Now I understand what you want, here's an answer that would help: http://stackoverflow.com/questions/7380373/django-celery-progress-bar#15117420 – laike9m Oct 02 '14 at 16:15