Move tasklib into subdirectory

Preparation for splitting tasklib up into separate files.
tasks: use inspect to generate list of functions
start writing tests for tasks.py
Add tests for converting arguments in tasks.py

Also refactored to remove code from main() to make it easier to test.
Start splitting up tasklib.py

- exceptions have their own file
- the global env dict has it's own file (to stop circular dependencies)
- link_local_settings() is the first function to move out
Convert tasks.py to use docopt
tasks: give helpful error message when project_settings can't be found
Split out various functions from tasklib.py

These are the ones that can be simply moved, without worrying about
circular dependencies.
Split database stuff out cleanly

So database stuff only imports from exceptions and utils.  The database
settings have to be set from the outside - currently done by functions
in django.

Django can then use the database functions cleanly, so more stuff has
been moved into django.