-
Notifications
You must be signed in to change notification settings - Fork 0
/
exception.py
46 lines (34 loc) · 1.01 KB
/
exception.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- encoding: utf-8 -*-
# @Contact : [email protected]
# @Time : 2019/4/26 10:47
# @Author : Natsu Yuki
from flask import *
app = Flask(__name__)
app.secret_key = '233'
@app.route('/')
def index():
flash('404 Not Found !')
return render_template('exception.html')
@app.route('/login', methods=['POST'])
def login():
form = request.form
name = form.get('name')
password = form.get('password')
print(name, password)
if not name:
flash('Please input name !')
return render_template('exception.html')
if not password:
flash('Please input password !')
return render_template('exception.html')
if name == 'natsu' and password == '233':
flash('successful !')
return render_template('exception.html')
else:
flash('Name or password is falure !')
return render_template('exception.html')
@app.errorhandler(404)
def not_found(e):
return render_template('404.html')
if __name__ == '__main__':
app.run()