Django ORM and PostgreSQL connection limits

Posted by bennylope on Stack Overflow See other posts from Stack Overflow or by bennylope
Published on 2010-06-15T22:45:57Z Indexed on 2010/06/15 22:52 UTC
Read the original article Hit count: 368

I'm running a Django project on Postgresql 8.1.21 (using Django 1.1.1, Python2.5, psycopg2, Apache2 with mod_wsgi 3.2). We've recently encountered this lovely error:

OperationalError: FATAL: connection limit exceeded for non-superusers

I'm not the first person to run up against this. There's a lot of discussion about this error, specifically with psycopg, but much of it centers on older versions of Django and/or offer solutions involving edits to code in Django itself. I've yet to find a succinct explanation of how to solve the problem of the Django ORM (or psycopg, whichever is really responsible, in this case) leaving open Postgre connections.

Will simply adding connection.close() at the end of every view solve this problem? Better yet, has anyone conclusively solved this problem and kicked this error's ass?

© Stack Overflow or respective owner

Related posts about python

Related posts about database