No, the name of the function does not matter (ie it does not have to match the route), as long as you do not have more than one function with the same name (then you will get an actual error when running the server)
AssertionError: View function mapping is overwriting an existing endpoint function
but what exactly is executing the function
It is a bit more complicated than that, but in the end of the day flask keeps a dictionary as a map between the "endpoint" (the function name) and the function object (which is the reason why function names must be unique):
self.view_functions[endpoint] = view_func
It also keeps a url_map
to map routes to functions:
Map([<Rule '/route_a' (OPTIONS, GET, HEAD) -> func_a>,
<Rule '/route_b' (OPTIONS, GET, HEAD) -> func_b>,
<Rule '/static/<filename>' (OPTIONS, GET, HEAD) -> static>])
{}