Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在导出在 Web 服务器进程启动期间读取和生成的数据。此数据的生命周期是 Web 服务器进程运行的持续时间(或者:您需要重新启动 Web 服务器才能离线输入任何新数据)。
我想在指向数据下载视图的 HTML 链接中添加一个缓存破坏参数。实际上,它应该是一个唯一的随机数,具体取决于进程启动时间戳或类似的进程唯一参数。
通常在 Plone 或 Python 进程中获取进程启动时间戳或类似唯一标识符的最佳方法是什么?
为什么不在你的 python 产品中生成一个新的 ID?在模块级别,在模块加载时定义一个新的随机常数:
import random RANDOMID = random.randit(0, 1<<32)
并使用它。