Django 中的通用进度条

发布于 2024-08-11 21:47:10 字数 238 浏览 3 评论 0原文

我想制作一个小型 Web 前端,用于使用 Django 为我的服务器复制(rsync)和编码(ffmpeg)文件。
我想跟踪流程的进度。

我看到了一些 jquery 脚本,但它们被设计为用于上传,而且我不知道足够的 javascript 来修改这些脚本以满足我的需要。
我想编写一个脚本,从文本文件中检索任务状态并输出进度条,但我不知道从哪里开始。

有人知道一个好的入门教程吗?

抱歉我的英语不好。

I want to make a little web-frontend for copying (rsync) and encoding (ffmpeg) files for my Server using Django.
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.
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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

几度春秋 2024-08-18 21:47:10

请参阅此处的代码 http://www.djangosnippets.org/snippets/679/,它说“上传多部分表单的进度”,但没有任何特定于表单的内容,您可以在任何地方使用它,只需进行一些调整。

一般概念是:

  1. 编写一个可以返回有关进度的数据(例如 JSON)的 Web 服务。
  2. 在客户端使用 JavaScript 调用进度 API 定期使用该信息来更新某些客户端元素,例如文本、图像宽度、某些 div 的颜色等。

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.

General concept is:

  1. Write a web-service which can return data(e.g. JSON) about the progress.
  2. On client side use JavaScript to call progress API periodically use that info to update some client side element e.g. a text, width of an image, color of some div etc.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文