text: #!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  'web app 三方框架 flask'
  
  __author__ = 'garyhu'
  
  from flask import Flask;
  from flask import request;
  from flask import render_template;
  
  
  app = Flask(__name__);
  
  @app.route('/', methods = ['GET', 'POST'])
  def home():
      return render_template('home.html')
  
  @app.route('/signin', methods = ['GET'])
  def login_page():
      return render_template('form.html')
                
  @app.route('/signin', methods = ['POST'])
  def login():
      # 需要从request对象读取表单内容：
      username = request.form['username']
      password = request.form['password']
      if username == 'admin' and password == '123456':
          return render_template('signin-ok.html',username=username);
      else:
          return render_template('form.html',message='Bad username or password', username=username)             
  
  if __name__ == '__main__':
      app.run();
  
  