change url_for call to prevent thread._local AttributeError