Q: Can't identify what's causing Flask Werkzeug BuildError I use URL parameters on my site as identifiers for user data. If a user clicks one specific link on the site, these parameters will be 'none', and I try to use the following function to then send them back to the same page with the correct parameters:
<a href="{{ url_for('site', param1='none', param2='none', param3='none', param4='none') }}">Site</a>

@app.route('/my-site/<param1>/<param2>/<param3>/<param4>', methods=['GET', 'POST'])
def site():

    if param1 == 'none':

       linking_data = Posts.query.filter_by(user=current_user.email).first()

       return render_template('site', param1=linking_data.param1, 
                                      param2=linking_data.param2, 
                                      param3=linking_data.param3, 
                                      param4=linking_data.param4)

If the params are hard-coded, this approach works well. If I attempt to define the params as I have above however, it results in the following error:
werkzeug.routing.BuildError: Could not build url for endpoint 'site' with values ['param3', 'param4'].     
Did you forget to specify values ['param1', 'param2']?

Why does it think I haven't specified the first two parameters?

A: You need to add the url parameters to the handler:
@app.route('/my-site/<param1>/<param2>/<param3>/<param4>', methods=['GET', 'POST'])
def site(param1=None, param2=None, param3=None, param4=None):
    ....

TIP: The None value outputs as string None, not none. It would be better if you updated your code to handle a string value for "none" that is not case-sensitive.
