I cannot figure out where the extra None
is coming from. I've tried these links to no avail: Build error with variables and url_for in Flask
how to use Flask Jinja2 url_for with multiple parameters
Also, I am not using BluePrint
.
Here is my users.html template:
<a href="{{ url_for('user_page', user_id=user.user_id) }}"> {{ user.name }} </a>
Here are two different user.py
files I've tried:
@app.route('/user')
def user_page():
args = show_user_parser.parse_args()
user_id = args['user_id']
return page_for_user(user_id)
@app.route('/user/<user_id>')
def user_page(user_id):
return page_for_user(user_id)
def page_for_user(user_id):
try:
cur.execute(list_user_detailed_query, (user_id,))
except psycopg2.OperationalError:
return render_template('error.html')
except psycopg2.IntegrityError:
connection.rollback()
return render_template('error.html')
data = cur.fetchone()
return render_template('user.html',
name=data['name'],
email=data['email'],
undergrad=data['undergrad'],
cv=data['cv'])
Here is the build error:
BuildError: ('user_page', {'user_id': '1'}, None)