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

This supercedes my previous patch. Ignore that one.