I'm trying to create a webpage in html in which a user have to input a url into a textfield.
<form name="submitURL" method ="post">
<input type="text" name="url_target">
<button type="submit">submit</button>
When the user press the submit button a python script should intercept the data inserted by the user and pass it to another function inside this script.
Python script:
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def indhtml() :
return render_template('index.html')
@app.route('/index.html', methods = ['POST'])
def result():
result = request.form('url_target')
link = result.link
print (link)
return
if __name__ == '__main__' :
app.run(debug = True)
the first render is fine and i can see the index.html page, but when i insert something in the textfield appears the error HTTP 405.
Do you have any suggestion for that? :( Thanks!