使用python制作静态登录界面

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from bottle import run,get,post,request,static_file,route
@route('/login')
def login_html():
return static_file('index.html',root='.')
@route('/login/:filename')
def login_css(filename):
return static_file('test.css',root='.')
@post('/login')
def login_submit():
name = request.forms.get('username')
passwd = request.forms.get('password')
if name == "qzdchw" and passwd == "123456":
return "<p>欢迎登录</p>"+name
else :
return "<p>密码错误</p>"
run(host='localhost',port=9999,debug=True)