Advertisement
ssoni

survey app.py

Apr 16th, 2021
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. from flask import Flask, render_template, request
  2.  
  3. app = Flask(__name__)
  4.  
  5. #serve up the main page (index)
  6. @app.route("/")
  7.  
  8. def index():
  9. return render_template("index.html")
  10.  
  11. @app.route("/collect", methods=['GET', 'POST'])
  12.  
  13. def collect():
  14. #get the POSTed data
  15. dog = request.form['dog']
  16. sport = request.form['sport']
  17. town = request.form['town']
  18. vaca = request.form['vaca']
  19. #robot = request.form['robot']
  20.  
  21. if 'robot' not in request.form:
  22. return("You are a robot. Ignored")
  23.  
  24. #save the data into file
  25.  
  26. #return HTML response page
  27. return("done") #browser
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement