I have at least 10 routes like this:
@app.route("/foo/bar")
def foo_bar():
return render_template('foo_bar.html')
@app.route("/foo/baz")
def foo_baz():
return render_template('foo_baz.html')
...
Each name is repeated three times: the name of the route, the name of the Python function, the name of the template.
What is the standard way with Flask (or Bottle) to do this?
>Solution :
Something like that?
@app.route("/foo/<arg>")
def foo_arg(arg):
return render_template(f"foo_{arg}.html")