python 定时清理django 过期 session

来源:互联网 发布:达内大数据课程 编辑:程序博客网 时间:2024/06/04 19:36
import time, os, sched schedule = sched.scheduler(time.time, time.sleep)     def perform_command(cmd, inc):         schedule.enter(inc, 0, perform_command, (cmd, inc))     os.system(cmd)         def timming_exe(cmd, inc = 60):         schedule.enter(inc, 0, perform_command, (cmd, inc))         schedule.run()             print("Clear up expire session by timer") os.chdir('D:/workspace/busymonkey')timming_exe("python manage.py clearsessions", 20)

0 0
原创粉丝点击