django runserver时如何启动线程? [英] how to start a thread when django runserver?

查看:475
本文介绍了django runserver时如何启动线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当django项目运行服务器成功时,我想启动一个线程. 我可以在哪里放置创建线程并启动代码? django runserver有钩子吗?

I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?

推荐答案

为什么要这么做? runserver仅用于开发,决不能在生产中使用.而且,如果您通过Apache运行,无论如何,它都应该为您管理线程/进程.

Why would you want to do that? runserver is for development only, it should never be used in production. And if you're running via Apache, it should manage threads/processes for you anyway.

这篇关于django runserver时如何启动线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆