Im very much new to Flask, and one of the starting requirements is that i need SEO friendly urls.
I have a route, say
@app.route('/sales/')
@app.route(/sales/<address>)
def get_sales(addr):
# do some magic here
# render template of sales
and a simple GET form that submits an address.
<form action={{ url_for('get_sales') }}>
<input type='text' name='address'>
<input type=submit>
</form>
On form submission, the request goes to /sales/?address=somevalue and not to the standard route. What options do I have to have that form submit to /sales/somevalue ? I feel like I'm missing something very basic.
You would need to use JavaScript to achieve this so your template would become:
and your routes similar to before:
However, this is not the best way of doing this kind of thing. An alternative approach is to have flask serve data and use a single-page-application framework in javascript to deal with the routes from a user interface perspective.