web applications - BuildError while using routing with variables -
from flask import flask, render_template app = flask(__name__) @app.route('/') def home(): return render_template("home.html") @app.route('/about/<name>') def about(name): return render_template('about.html') if __name__ == '__main__': app.run(debug=true)
when go to: http://localhost:5000/about/abc
this code gives me:
builderror: not build url endpoint 'about'. did forget specify values ['name']?
what doing wrong ?
the solution add name=name in layout.html about.html inherits. don't understand whats happening here.
<li><a href="{{ url_for('about', name=name) }}">about</a></li>
it sounds failed create about.html in templates folder. make sure folder called templates , in same directory python code.
Comments
Post a Comment