Major reorganization of architecture

It creates the common module, where the C++ database interface library
now lives, implements some of the controller code, fixes the build
(everything should build cleanly), renormalizes the database schemas
into Boyce-Codd normal form, and changes the Django backend to PostgreSQL.