S
S
Stan2016-05-27 12:16:52
Python
Stan, 2016-05-27 12:16:52

Navigating @route to bottle, how to do it right?

Good afternoon.
Prompt, I form a route with html page.
button on the page. How to bind the next route to this button.
- went to the route /index
- clicked on the button and went to the route /A1

from bottle import run, route
@route('/index')
def f_index():
    return("""
    <html>
    <form  action="/A1" method="post">
    <input value="A1" type="submit" />
    </form>
    """)
@route('/A1')
def A1():
    return("""
        <html>
        Hello world !
        </form>
        </html>
        """)    
run(host='localhost', port="8080", debug=True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2016-05-27
@SantaKlaud

For A1, you make a post request (action="/A1" method="post"),
so instead of @route('/A1'), you need to @post('A1'), or specify the post method in the router

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question