Remove stray os.close(fd)

A fallout from 2bc49e00d7485dabb5659c8104d5224ec1cad451.
Minor cleanups on views, templates and url patterns
Split foreign relations in initial migrations into separate migrations

Postgres is more of a stickler when it comes to constraints. Since we
can't defer constraint creation, nor defer its validation over multiple
migrations, we have to split the migrations.
This probably won't be a problem in Django 1.7.
We are also splitting the migrations on existing installs (checking for
existing table/column names)
Fixes #3160
Travis: Split dependencies into their own file

This avoids extra dependencies when building the package outside travis.
Travis: Add a travis-specific settings file
Travis: Add postgres to the testing matrix
Travis: Add mysql to the testing matrix
Travis: Always build with memcached