url_for() paramater was ignored in flask
<p>My route method is:</p>

<pre><code>@app.route('/movie/')
def movie(page_num=1):
#...detail skiped...
</code></pre>

<p>And my template is:</p>

<pre><code>&lt;li&gt;&lt;a href="{{ url_for('movie',page_num=page_num) }}"&gt;{{ page_num }}&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>When I click the link,the address bar shows <em>"127.0.0.1:5000/movie/?page_num=5"</em>,but the <em>pagination.page</em> shows it is still page 1.</p>

<p>Why the paramater was ignored and how can I fix it?</p>

<p>Since you skipped the code of your function it's hard to say what's wrong. But I suspect that you just don't catch GET parameters correctly. To do this you can either use <a href="http://flask.pocoo.org/docs/0.11/quickstart/#variable-rules" rel="nofollow">variable rules</a> with dynamic name component in your route; or access parameters submitted in the URL with <code>request.args.get</code>.</p>

<p>Here's a minimal example showing boths methods:</p>

<pre><code>from flask import Flask, url_for, request
app = Flask(__name__)

@app.route('/')
def index():
    link = url_for('movie',page_num=5)
    return "&lt;a href='{0}'&gt;Click&lt;/a&gt;".format(link)

@app.route('/index2')
def index_get():
    link = url_for('movie_get',page_num=5)
    return "&lt;a href='{0}'&gt;Click&lt;/a&gt;".format(link)


@app.route('/movie/&lt;page_num&gt;')
def movie(page_num=1):
    return str(page_num)

@app.route('/movie_get')
def movie_get():
    param = request.args.get('page_num', '1')
    return str(param)

if __name__ == '__main__':
    app.run(debug=True)
</code></pre>

python flask url-for