xywuyiba6 发表于 2018-8-14 10:40:42

python web 开发框架之Bottle-Microsoft

#!/usr/bin/env python  
# -*- coding: utf-8 -*-
  

  
import sys
  
reload(sys)
  

  
from bottle import request, route, run, template
  

  
@route('/login', method='POST')
  
def do_login():
  
    username = request.forms.get('username')
  
    password = request.forms.get('password')
  

  
    print (username, password)
  

  
    if username == 'admin' and password == 'admin':
  
      return username + '登录成功'
  
    else:
  
      return username + '登陆失败'
  

  
#用户登录
  
@route('/index')
  
def index():
  
    return template('index')
  

  
run(host='0.0.0.0', port=9090, debug=True)
页: [1]
查看完整版本: python web 开发框架之Bottle-Microsoft