from pyramid_jinja2 import Environment

def get_endpoint(str):
    """
    :param str:
    :return:
    """
return str.split('/')[-1]
env = Environment()
env.filters['get_endpoint'] = get_endpoint
Jinja - Is there any built-in variable to get current HTML page name?