Django progress bar

I use Django to upload a file and hit ETL jobs with

  subprocess 

The task takes about 15 seconds, and instead of the user believing that the page is frozen, I would like to show a progress bar .

I can find out that AJAX is updating the progress bar, but what I do not know how to do is return HttpResponse while the subprocess is running. Perhaps threading is the solution? I do not have experience. Can someone give me some guidance?

Here is the view:

def start_job(request): if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid() and form.is_multipart(): save_file(form.cleaned_data['file']) subprocess.call(["Kitchen.bat", "/file:job.kjb"]) return HttpResponseRedirect('/success/') else: form = UploadForm() return render_to_response('template.html') 
+4
source share
1 answer

Thanks @Bula, django-celery is the perfect solution.

Here you will find a good introduction video .

+2
source

All Articles