Guest User

Untitled

a guest
Apr 16th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from flask import Flask, request, render_template
  2.  
  3. app = Flask(__name__)
  4.  
  5. @app.route('/', methods = ['GET', 'POST'])
  6. def home():
  7. return render_template('home.html')
  8.  
  9. @app.route('/signin', methods = ['GET'])
  10. def signin_form():
  11. return render_template('form.html')
  12.  
  13. @app.route('/signin', methods = ['POST'])
  14. def signin():
  15. username = request.form['username']
  16. password = request.form['password']
  17. if username == 'admin' and password == 'password':
  18. return render_template('signin-ok.html', username = username)
  19. return render_template('form.html', message = 'Bad uername or password', username = username)
  20.  
  21. if __name__ == '__main__':
  22. app.run(host = '127.0.0.1', port = 8000)
Add Comment
Please, Sign In to add comment