Gevent Django and Postgres: A tale of a why!?
• Mark Eschbach
Today has been a really furstrating day for sure. I’ve attempted again to venture into having Django handle asynchronus traffic in hopes of increasing service density. Again I’ve been defeated. Not a minor defeat either.
In a framework like Django I feel like this should really be a realitvely simple task. And for the actual framework it has been. As for the database libraries it hasn’t been though. The primary pain I’ve felt has been around using psycopg2 in gevent mode. Besides spinning gunicorn up in
gevent mode you’ll also need to set
True in the database configuration. Turns out you definitely don’t want the the configuration also needs significant changes in
AUTOCOMMIT set to
True as your migraitons will fail.
It appears as though this was a feature added in early Feburary. Looks like they were attempting to prevent problems with modifying transactional isolation. Since this casues the problem I’m going to try rolling back the library version. These were merged in at 3ff350c on Feb 6th ot
master. So the last of the 2.6 series: 2.6.3 should do the trick. Let’s see what the results are.
Meanwhile I checked the Django release notes. No mention of transactional behavior, so bummer?
Alrighty, our Travis queue is backed up. It’s time to take off my work hat and start wearing my father hat anyway.