I doing a flask app and when i try to put a link to redirect a user to his profile page by calling
BuildError: Could not build url for endpoint 'profile'. Did you forget to specify values ['business_name']?
when i try to login a user.My app works fine the previous days with this same code i do not what has happen and i have tried all possible means to get this right but no way
@app.route('/profile/<business_name>')
@login_required
def profile(business_name):
user = User.query.filter_by(business_name=business_name).first()
if user == None:
flash('This Profile does not exist {}'.format(business_name))
return redirect(url_for('login'))
return render_template('profile.html',user=user)
(main.html)
<ul class="nav navbar-nav">
<li><a href="{{ url_for('home_page') }}" class="active">Home</a></li>
{% if g.user.is_authenticated %}
<li><a href="{{ url_for('profile', business_name=g.user.business_name) }}">Your Profile</a></li>
<li><a href="{{url_for('logout')}}">Logout</a></li>