Your code works fine, but you misunderstood how the /signup
route works.
The homepage holds the form; visit http://localhost:5000/
in your browser and you'll see a white textbox and signup
button there. Text you fill into that box will be posted to the server
The console would look like:
* Running on http://127.0.0.1:5000/
127.0.0.1 - - [08/May/2014 15:00:53] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [08/May/2014 15:00:53] "GET /favicon.ico HTTP/1.1" 404 -
The email address is 'abcd'
127.0.0.1 - - [08/May/2014 15:00:57] "POST /signup HTTP/1.1" 302 -
127.0.0.1 - - [08/May/2014 15:00:57] "GET / HTTP/1.1" 200 -
where GET /
is the browser fetching the homepage with form, the POST /signup
is the form being posted, which then issues a 302 redirect back to the homepage, which is fetched by the browser next.
The /signup
route, as configured, can only handle a POST
request, like what the browser produces for the form result. You don't normally visit it in the browser; entering http://localhost:5000/signup
produces a GET
request instead.
In other words, the error you see is by design; the route only supports POST requests.