开始Flask项目

时间:2017-11-04 10:21:08   收藏:0   阅读:522

1.新建Flask项目。

2.设置调试模式。

3.理解Flask项目主程序。

4.使用装饰器,设置路径与函数之间的关系。

5.使用Flask中render_template,用不同的路径,返回首页、登录员、注册页。

6.用视图函数反转得到URL,{{url_for(‘login’)}},完成导航条里的链接。

from flask import Flask,render_template

app = Flask(__name__)


@app.route(/)
def base():
    return render_template(base.html)

@app.route(/ll/)
def ll():
    return render_template(ll.html)

@app.route(/zc/)
def zc():
    return render_template(zc.html)

if __name__ == __main__:
    app.run(debug=True)

技术分享

 

原文:http://www.cnblogs.com/0020l/p/7781316.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!