I got a lot of errors with the message :
"DatabaseError: current transaction is aborted, commands ignored until end of transaction block"
after changed from python-psycopg to python-psycopg2 as Django project's database engine.
The code remains the same, just dont know where those errors are from.
In Flask shell, all I needed to do was a
session.rollback()
to get past this.just use rollback
Example code
you could disable transaction via "set_isolation_level(0)"
In Flask you just need to write:
P.S. Documentation goes here https://www.postgresql.org/docs/9.4/static/sql-rollback.html
To get rid of the error, roll back the last (erroneous) transaction after you've fixed your code:
You can use try-except to prevent the error from occurring:
Refer : Django documentation
If you get this while in interactive shell and need a quick fix, do this:
originally seen in this answer