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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -