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

...onverting domain to template path.

This supercedes my previous patch. Ignore that one.