2024-05-26 20:47:44 发布
网友
在a.py,我导入了django的settings.py,我需要修改settings.DEBUG。你知道吗
a.py
settings.py
settings.DEBUG
但如何在python脚本中实现呢?你知道吗
我这样做了,但没有改变,settings.DEBUG=False
settings.DEBUG=False
你可能想研究一下django做“本地”设置的不同方法。你知道吗
有很多不同的方法。我的方法在Modular Django Settings中有详细描述。你知道吗
https://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime我想这是你想要的。你知道吗
就像上面说的:
from django.conf import settings settings.DEBUG = True # Don't do this!
The only place you should assign to settings is in a settings file.
祝你好运!你知道吗
你可能想研究一下django做“本地”设置的不同方法。你知道吗
有很多不同的方法。我的方法在Modular Django Settings中有详细描述。你知道吗
https://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime我想这是你想要的。你知道吗
就像上面说的:
The only place you should assign to settings is in a settings file.
祝你好运!你知道吗
相关问题 更多 >
编程相关推荐