Add a constructor to override database setting

The database was hardcoded to always follow Django settings. Now it
is a bit more dynamic.