简体   繁体   English

Django中的通用进度条

[英]General Purpose Progressbar in Django

I want to make a little web-frontend for copying (rsync) and encoding (ffmpeg) files for my Server using Django. 我想使用Django为我的服务器复制(rsync)和编码(ffmpeg)文件做一个小小的前端。
And I want to keep track of the progress of the processes. 我想跟踪流程的进展情况。

I saw a few jquery-scripts, but they are designed to be used with uploads, and I don't know enough javascript to modify these scripts for my needs. 我看到了一些jquery脚本,但它们被设计用于上传,我不知道足够的javascript来修改这些脚本以满足我的需求。
I want to write a script that retrieves the task status from a textfile and outputs a progressbar, but I've got no idea where to start. 我想编写一个脚本,从文本文件中检索任务状态并输出进度条,但我不知道从哪里开始。

Does somebody know a good tutorial to start with? 有人知道一个很好的教程吗?

And sorry for my poor english. 抱歉我的英语不好。

See the code here http://www.djangosnippets.org/snippets/679/ , it says "upload progress for multipart forms" but there is nothing specific to forms, you can use it anywhere with few tweaks. 请参阅http://www.djangosnippets.org/snippets/679/中的代码,它说“多部分表单的上传进度”,但没有任何特定的表单,您可以在任何地方使用它几乎没有调整。

General concept is: 一般概念是:

  1. Write a web-service which can return data(eg JSON) about the progress. 编写一个可以返回有关进度的数据(例如JSON)的Web服务。
  2. On client side use JavaScript to call progress API periodically use that info to update some client side element eg a text, width of an image, color of some div etc. 在客户端使用JavaScript调用进度API定期使用该信息来更新一些客户端元素,例如文本,图像的宽度,某些div的颜色等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM