Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
django apscheduler 在哪里定义才能执行啊
guoguobaba
·
Oct 17, 2023
· 1980 views
This topic created in 1130 days ago, the information mentioned may be changed or developed.
按照文档创建了一个
task.py
,放在 apps 下面,里面执行
`scheduler.start()`
然后 python
manage.py
runserver 并没有启动这个 schedule
把代码 copy 到`apps/
urls.py
`,schedule 可以执行
需要在哪里设置一下
tasks.py
吗?
schedule
apps
执行
runserver
2 replies
•
2023-10-17 14:06:30 +08:00
lybcyd
Oct 17, 2023
1
最好是新建一个 command ,然后通过另一进程单独执行。放到 apps 或者 urls 等文件里面的问题是,实际上部署 wsgi 会有多个 worker 进程,导致计划任务多次执行。
guoguobaba
OP
Oct 17, 2023
2
@
lybcyd
这个好说,我用 MemoryJobStore 。
需求是 django 里用到了一个 pool ,要定时释放空闲的 pool 信息,所以只用考虑当前进程下面的内容,不需要持久化保存。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1173 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms ·
UTC 18:07
·
PVG 02:07
·
LAX 10:07
·
JFK 13:07
♥ Do have faith in what you're doing.
❯