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

查看:19
本文介绍了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天全站免登陆