标签:style blog http io color os sp on div
from flask import Flask, request from flask import render_template app = Flask(__name__) app.debug=True @app.route(‘/hello/‘) @app.route(‘/hello/<name>‘) def hello(name=None): return render_template(‘hello.html‘, name=name) @app.route(‘/login‘, methods=[‘GET‘, ‘POST‘]) def login(): if request.method == ‘GET‘: return ‘GET‘ else: return ‘POST‘ @app.route(‘/user/<username>‘) def profile(username): pass app.run()
<!doctype html> <title>Hello from Flask</title> {% if name %} <h1>Hello {{ name }}!</h1> {% else %} <h1>Hello World!</h1> {% endif %}
在模板里面哦我们经常会操作 request, session, g 对象,还有get_flash_messages()函数
标签:style blog http io color os sp on div
原文地址:http://www.cnblogs.com/jypwn/p/4111379.html