I have see some code of everybody on here. But it's still difficult, and lost a ton of time. Have some way to do this ? Thank you, love all.
Asked
Active
Viewed 44 times
-1
-
Possible duplicate of [How can I see the raw SQL queries Django is running?](https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running) – Pynchia Oct 17 '19 at 02:51
2 Answers
0
You can use django.db.backends
log to log the sql queries. Set this on your settings.py:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
}
},
'loggers': {
'django.db.backends': {
'handlers': ['console'],
'level': 'DEBUG',
},
}
}

Toan Quoc Ho
- 3,266
- 1
- 14
- 22