django - settings.py seems to load multiple times?(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 似乎加载了多次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:django - settings.py 似乎加载了多次?
基础教程推荐
- 修改列表中的数据帧不起作用 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 包装空间模型 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
