python - Django-Axes causing DatabaseError - Transaction Block -
python - Django-Axes causing DatabaseError - Transaction Block -
so i've updated django 1.4.5 , postgres 9.2.3 , psycopg2 2.4.6 . runserver
, looks ok, when go localhost:8000
see infamous 'current transaction aborted..' on request.session.save()
in sessions/middleware.py(36).
i ran syncdb
, migrate
, no errors or changes matter. added in 'databases' - 'options': {'autocommit': true, }, still no help. , tried this:
from django.db import connection connection._rollback()
in django shell.
i tried stop postgres with:
pg_ctl -d /usr/local/var/postgres stop -s -m fast
and get:
pg_ctl: server not shut downwards
running pg -ef|grep postgres
shows no hanging queries.
how can resolve block? how find causes it?
answer: a summery of did solve error
i enabled sql logging:
debug=true logging = { 'version': 1, 'disable_existing_loggers': false, 'handlers': { 'null': { 'level': 'debug', 'class': 'django.utils.log.nullhandler', }, 'console': { 'level': 'debug', 'class': 'logging.streamhandler', 'formatter': 'simple' } }, 'loggers': { 'django': { 'handlers': ['console'], 'level': 'debug', }, } }
this showed me sql statements beingness executed, including 1 causing internal db error, in case caused django-axes(i upgraded before version 1.2.9).
django-axes requires tables created. re-running syncdb didn't solve problem b.c there alter within 1 of tables (new field - username).
python manage.py sqlclear axes
- showed me tables drop, went psql , did that. after ran 1 time again python manage.py syncdb
, got updated tables.
and found bug within __init__.py
of axes module, in get_version()
- wrong string formatting. fixing solved mess :)
finally, happy ending!
python django transactions django-postgresql
Comments
Post a Comment