Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在考虑让 settings.py 开始这个过程,但这看起来有点难看。
我真的不想制作自定义启动脚本,也不能真正让这个过程的启动变得懒惰。
您也许可以在您的模型类之一上注册“类准备”信号的侦听器并从那里触发您的进程。但是,我认为这样做的必要性很可能是设计气味,或者是尾巴摇摆不定的情况。
http://docs.djangoproject.com/en/dev/ref/signals/#class-prepared
我很想知道为什么您的设计需要这样做,但这可能会让我们偏离主题。