django issues and quick fixes
Fighting with django
February 4, 2022 · 71 words · 1 min read · tech, programming
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,
},
},
}
a quote i like
I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain. ― Frank Herbert, Dune