【发布时间】:2020-08-19 09:02:03
【问题描述】:
我需要一些帮助来为 django-simple-captcha 制作 cron 作业,以便能够每天或每小时从 postgresql captcha_captchastore 表中删除验证码数据库记录。在 captcha_captchastore 表中有一个过期日期时间列。根据文档和维护者本人,您可以使用:
CAPTCHA_GET_FROM_POOL、CAPTCHA_GET_FROM_POOL_TIMEOUT、CAPTCHA_TIMEOUT 设置
结合python3 manage.py captcha_create_pool 命令。
但是文档有点混乱,并没有向您展示如何使用 postgres 执行 cron 工作的示例。
我也不知道在生产环境中,当站点在 gunicorn 中运行时运行 python3 manage.py captcha_create_pool 是否好。是否需要停止 gunicorn 才能使用 cron 作业运行 captcha_creat_pool 命令?
可以使用以下任何 django 包来简化此操作吗?如果有,怎么做?
如果有人给出一个很好的例子或描述如何做到这一点,我会更喜欢。
https://djangopackages.org/grids/g/cron/
https://django-simple-captcha.readthedocs.io/en/latest/advanced.html
【问题讨论】:
标签: python django postgresql cron captcha