a guest Sep 21st, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- from flask import Flask, flash, redirect, render_template, request, url_for
- app = Flask(__name__)
- app.secret_key = 'random string'
- def index():
- return render_template('index.html')
- @app.route('/login', methods = ['GET', 'POST'])
- def login():
- error = None
- if request.method == 'POST':
- if request.form['username'] != 'admin' or \
- request.form['password'] != 'admin':
- error = 'Invalid username or password. Please try again!'
- flash('You were successfully logged in')
- return redirect(url_for('index'))
- return render_template('login.html', error = error)
- def do_stuff():
- if __name__ == "__main__":
- app.run(debug = True)
RAW Paste Data