![]() | 1 7gong 2013-01-22 13:02:03 +08:00 用 curl 定时出发某个 Post 或 get 页面就是了 |
![]() | 2 adieu 2013-01-22 13:06:21 +08:00 ![]() 可以试试看用 celery http://celeryproject.org/ 来做。定期执行和接受webapp下发的task都可以实现。 |
![]() | 4 ratazzi 2013-01-22 13:21:22 +08:00 ![]() 开个线程跑也是一个办法,如果要后台以命令方式运行的话还是建议用 supervisor,不要用 nohup |
![]() | 5 Js 2013-01-22 14:10:09 +08:00 ![]() 轻量级的daemon其实可以这样实现 import os, ctypes import ctypes.util ctypes.CDLL(ctypes.util.find_library('c')).daemon(0,0) open('/var/run/demo.pid','w').write(str(os.getpid())) |
![]() | 7 BigZ 2013-01-23 18:52:00 +08:00 你是想用django的 orm部分吧,把这段加到你的py文件头部,文件可以单独执行 import sys, os PROJECT_DIR = os.path.dirname(os.path.dirname(__file__)) sys.path.append(PROJECT_DIR) from django.core.management import setup_environ import settings setup_environ(settings) |
![]() | 8 Js 2013-01-25 14:35:31 +08:00 |
![]() | 10 mitnk 2013-01-25 14:53:03 +08:00 ![]() |
![]() | 11 rockhead OP 谢谢各位 我实践一下 |