Create a progress bar showing copying files progress with the help of Celery in Django framework
up vote
0
down vote
favorite
Generally speaking, I need to creat a html page with progress bar showing the file copying progress after the user pressed the "DO" button.
Below are what I have done and tried:
Following is the "progress bar" element in theml:
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
Below, in the Celery task named "copying", I update the task status with the variable "progressPercentage" in JSON format.
self.update_state(state = 'PROGRESS', meta =
{'percentage':progressPercentage})
So the question is, how should I code in HTML to let the Progress bar element updated with the return JSON data (showing above) from function without refreshing the page. The key here is: how to return the JSON data from called function to Javascript.
I tried something like this below:
return HttpResponse(Celery.AsyncResult(copying.request.id))
But seems it is not correct.
javascript html django progress-bar celery
add a comment |
up vote
0
down vote
favorite
Generally speaking, I need to creat a html page with progress bar showing the file copying progress after the user pressed the "DO" button.
Below are what I have done and tried:
Following is the "progress bar" element in theml:
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
Below, in the Celery task named "copying", I update the task status with the variable "progressPercentage" in JSON format.
self.update_state(state = 'PROGRESS', meta =
{'percentage':progressPercentage})
So the question is, how should I code in HTML to let the Progress bar element updated with the return JSON data (showing above) from function without refreshing the page. The key here is: how to return the JSON data from called function to Javascript.
I tried something like this below:
return HttpResponse(Celery.AsyncResult(copying.request.id))
But seems it is not correct.
javascript html django progress-bar celery
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Generally speaking, I need to creat a html page with progress bar showing the file copying progress after the user pressed the "DO" button.
Below are what I have done and tried:
Following is the "progress bar" element in theml:
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
Below, in the Celery task named "copying", I update the task status with the variable "progressPercentage" in JSON format.
self.update_state(state = 'PROGRESS', meta =
{'percentage':progressPercentage})
So the question is, how should I code in HTML to let the Progress bar element updated with the return JSON data (showing above) from function without refreshing the page. The key here is: how to return the JSON data from called function to Javascript.
I tried something like this below:
return HttpResponse(Celery.AsyncResult(copying.request.id))
But seems it is not correct.
javascript html django progress-bar celery
Generally speaking, I need to creat a html page with progress bar showing the file copying progress after the user pressed the "DO" button.
Below are what I have done and tried:
Following is the "progress bar" element in theml:
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
Below, in the Celery task named "copying", I update the task status with the variable "progressPercentage" in JSON format.
self.update_state(state = 'PROGRESS', meta =
{'percentage':progressPercentage})
So the question is, how should I code in HTML to let the Progress bar element updated with the return JSON data (showing above) from function without refreshing the page. The key here is: how to return the JSON data from called function to Javascript.
I tried something like this below:
return HttpResponse(Celery.AsyncResult(copying.request.id))
But seems it is not correct.
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
Copying progress:
<progress id = "progressCopy" value="0" max="100">
</progress>
javascript html django progress-bar celery
javascript html django progress-bar celery
asked Nov 8 at 11:17
Ping Zhou
55
55
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206669%2fcreate-a-progress-bar-showing-copying-files-progress-with-the-help-of-celery-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown