Advertisement
Guest User

Untitled

a guest
May 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. from flask import Flask, send_from_directory, render_template,request
  2. import re
  3.  
  4. app = Flask(__name__)
  5.  
  6.  
  7. @app.route("/login", methods=['POST', 'GET'])
  8. def main():
  9. return send_from_directory('template', 'First_window.html')
  10.  
  11.  
  12. @app.route("/login",methods=['POST','GET'])
  13. def Yes():
  14. if request.method == "POST":
  15. if request.form['answer'] == 'a1':
  16. return send_from_directory('Html', 'tests.html')
  17. return send_from_directory('template', 'First_window.html')
  18.  
  19.  
  20. @app.route("/File",methods=['POST','GET'])
  21. def File():
  22. if request.methods == "POST":
  23. f = request.files['file'].read()
  24. txt = str(f.decode('utf-8'))
  25. return send_from_directory('Html', 'tests.html')
  26.  
  27.  
  28. if __name__ == '__main__':
  29. app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement