Fix Gateways datamigration backwards (#236)

* Use south ORM to create gateways dumped to a file in JSON.
* Handle exceptions when file doesn't exist or has invalid format.