Handle get_site returning None. Remove port and '.local' suffix before converting domain to template path.

This supercedes my previous patch. Ignore that one.
Merge pull request #4 from andybak/patch-3

Handle get_site returning None. Remove port and '.local' suffix before c...