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 似乎加载了多次?
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01