simplejson fix, add pytz to remove naive datetimes

Also two fixes to `base_template` function