Moved database stuff inside the app. Edit config. Began adding tests interacting more heavily with the db.
Altered config. Added tests.

 * Added configuration for Test and Production
 * Added further tests for db stuff, after figuring out problems