Create database indexes up-front in setup_db function before starting the app

This branch fixes one of the issues reported in #776.

## Background

By default, mongoengine creates database indexes lazily when inserting a document in the database. This means, database could end up in a bad / corrupted state if there are multiple concurrent request trying to insert a document before an index has been created.

In our case, this showed up as duplicate entries which violate the unique constraint in the DB. The reason why this could happen is because insert happened before unique and other indexes were created.

## Proposed solution

In this branch I create all the indexes up-front in the `setup_db` function. This function is always called first before the application becomes available. This means it should now be impossible for the database to end up in a state which violates index constraints.

Note: Since we now manually create the indexes, we could also set `auto_create_index` attribute on all the models to `False` (see 6th paragraph on http://docs.mongoengine.org/apireference.html#documents).