0
我的設置文件有:如何測試Django是否在調試模式下運行?
DEBUG = True
最明顯的方法:
if DEBUG:
print 'debug'
似乎不工作:
global name 'DEBUG' is not defined
我的設置文件有:如何測試Django是否在調試模式下運行?
DEBUG = True
最明顯的方法:
if DEBUG:
print 'debug'
似乎不工作:
global name 'DEBUG' is not defined
正如評論所說,你需要做的:
from django.conf import settings
print settings.DEBUG
您需要通過'settings.DEBUG'去 –