app/management/commands/command_scheduler.py
:
class Command(BaseCommand):
def handle(self, *args, **kwargs):
insert()
import threading
_thread = threading.Thread(target=insert)
_thread.setDaemon(True)
_thread.start()
这是简单的测试代码(我正在使用Apscheduler,BackgroundScheduler插入了DB,但未执行。)
请回复。