Django issues and quick fixes
Fighting with django
February 4,2022
last update: 2024-11-19
CSRF token invalid __URL__
not in trusted origin
This happens because there is no CSRF_TRUSTED_ORIGINS
in the settings file. Also make sure that the url does not have an end slash
log all sql queries
simply add in settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'sql.log',
},
},
'loggers': {
'django.db.backends': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}