Fix settings.py to use the correct databases

There was a bug in using "is" instead of "==" to compare hostnames, and
using next() on a list instead of an iterator.
Merge branch 'unstable' of https://github.com/ARmadillo-reuse/api-server