Two phase require: libs then models

This allows the database connection to be customized in a database
initializer.
Merge pull request #110 from interagent/brandur-two-phase

Two phase lib + model require