teslaworksumn/teslaworks.net — pull request #159 by mplewis (2013-10-29 02:28:53+00:00)
Title: Use a single DB connection instead of opening one on each load

When `ProjectsController` is created, it opens a connection.

When it's closed, it closes that connection.

If we're feeling cool, we can use `with ProjectsController() as projects_controller`. But I don't think that works with Flask's layout and scoping.

We do have to register an `atexit` function to serve as a pseudo-`finally`.