django - settings.py似乎加载多次? [英] django - settings.py seems to load multiple times?

查看:308
本文介绍了django - settings.py似乎加载多次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑我错了 - 打印出两次,而不是四次。

EDIT I miscounted - it is printed out twice, not four times.

我把它放在我的 settings.py

print 'ola!'

,启动时ola打印出两次!这似乎是我的pycharm django项目的一些错误...任何想法为什么会发生这样的事情?它不是一个循环或任何东西(我知道,无论如何)

and on startup "ola" is printed out twice! This seems like something is wrong with my pycharm django project ... any ideas why this would happen? It isn't in a loop or anything (that i'm aware of, anyway)

欢呼!

YAY 根据评论,只有rohit的用户已经确定可以在这里找到一个解决方案: https://stackoverflow.com/a/2110584/1061426 〜看到关于禁用重新加载的评论。

YAY The user known only as "rohit", as per the comments, has determined that a solution can be found here: https://stackoverflow.com/a/2110584/1061426 ~ see the comment about disabling reloading.

小心我现在没有Django代码,所以我不知道noload会做什么。祝你好运,士兵。

CAUTION I don't have my Django code up and about now, so I don't know what the noload will do. Good luck, soldiers.

推荐答案

如果您打印出settings.py中的线程ID,您将看到settings.py实际上被加载到两个不同的线程。

If you print out the thread ID within settings.py, you will see that settings.py is actually being loaded on two different threads.

请参阅这个stackoverflow响应这篇文章了解更多信息。

See this stackoverflow response and this article for more info.

这篇关于django - settings.py似乎加载多次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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