Django 1.6 introduces a Persistent Connections feature. However I've noticed that exiting a script that uses django's ORM leaves at least some of the connections open on the db side.
Setup: django 1.6.0, postgres 9.2 and psycopg2 2.5.1.
How do you gracefully close the connection to the database from a script?
The caveats section mentions that django opens a connection per thread, so in a multi-threaded script, does django create a connection per thread, even for threads that do not access the db?
Does each thread need to close the db connection separately?
If the answer to both questions above is yes, what can you do with daemon threads (e.g. for comm) which do not join on script exit?