Django设置查看原生SQL语句

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console':{
            'level':'DEBUG',
            'class':'logging.StreamHandler',
        },
    },
    'loggers': {
        'django.db.backends': {
            'handlers': ['console'],
            'propagate': True,
            'level':'DEBUG',
        },
    }
}  

可以查看orm底层的SQL语句,然后借助explain进行分析

猜你喜欢

转载自www.cnblogs.com/tangkaishou/p/10792090.html