forked from edgardeng/flaskAll
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.py
More file actions
29 lines (21 loc) · 757 Bytes
/
Copy pathindex.py
File metadata and controls
29 lines (21 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, render_template, request
from flask_bootstrap import Bootstrap
app = Flask(__name__)
bootstrap = Bootstrap(app)
@app.route('/')
def index():
name = 'flask'
return render_template('index.html', name=name)
@app.route('/signup', methods=['GET'])
def signup():
name = 'flask'
return render_template('signup.html')
@app.route('/signup', methods=['POST'])
def signupPost():
username = request.form['username']
password = request.form['password']
if username == 'admin' and password == 'admin':
return render_template('index.html', name=username)
return render_template('signup.html', message='Bad username or password', username=username)
if __name__ == '__main__':
app.run(debug=True)