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'去 –