0
votes

I'm making a python code and using flask to make a webpage.I need to take input from this html page into python and after processing sending back to html page.How I can do so ?

`Blockquote from flask import Flask, render_template

  app = Flask(__name__)

   @app.route('/')

  def  home():
       return render_template("login.html")


  @app.route('/about/')

  def  about():
       return ('you wil get all sort of shayari here')

   if __name__ == "__main__":
       app.run() 
                  '
1
Does this answer your question? Send data from a textbox into Flask? - gittert

1 Answers

0
votes

You can achieve the same within a single view. Assume if you want to register user you can do something like this.

 @app.route("/register_user", methods=["GET", "POST"])
    def register_user():
        """Register user."""
        form = SomeForm() 
        # treat POST request 
        if form.validate_on_submit():
           # do something ... 
           # return redirect ... 


        # else response to GET request
        # return render_template... 

Let me know if this solves your problem.