I've got the following app:
server.py
@app.route('/')
def main():
return render_template('index.html')
@app.route('/login')
def login():
return 'hey'
index.html
<body>
<form action="http://localhost:5000/login" , method="post">
<input type="submit" value="submit">
</body>
Now I run ngrok:
ngrok http 5000
After typing address (generated by ngrok) into web browser I can see index.html page with button, but when I press the button it redirects me to http://localhost:5000/login where I can see: "connection refused". My question is how to set ngrok and flask server the way they can communicate?
P.S. I've put only a part of my code just for better reading
What happens if you add the POST
method to the login route
@app.route('/login', methods=['POST'])
def login():
return 'hey'
and change the form action to
<body>
<form action="/login", method="post">
<input type="submit" value="submit">
</body>
hm?