-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (33 loc) · 1.02 KB
/
app.py
File metadata and controls
38 lines (33 loc) · 1.02 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: lingyuguo
@contact: lingyuguo6240@163.com
@Time : 2020/7/25 12:52
"""
from flask import Flask, request, render_template
from static import settings
app = Flask(__name__)
app.config.from_object(settings)
users = [] #存储用户数据
@app.route("/index")
def index():
return render_template("index.html")
@app.route("/user", methods=["GET", "POST"])
def user():
if request.method == "POST":
username = request.form.get('username') #获取form data
password = request.form.get('password')
repassword = request.form.get('repassword')
if repassword == password: #密码一致性
user = {"username": username,"password" : password}
users.append(user) #保存数据
return "注册成功"
else:
return "两次密码不一致"
return render_template("user.html")
@app.route("/show")
def show():
return users
if __name__ == '__main__':
app.run()