In Flask, you write the route above the method declaration as follows:
@app.route('/search/<location>/')
def search():
return render_template('search.html')
However, in HTML, how the form will publish the URL in this way
www.myapp.com/search?location=paris
the latter seems to return 404 from the application where
www.myapp.com/search/london
will return as expected.
I'm sure there is a simple piece of the puzzle that I don’t get, but, of course, the routing mechanism will consider the query string parameters to meet the requirements of the rules.
If this is not the best solution for this scenario, since I am sure that 90% of developers should come to this point ...
early.
source
share