Blueherb In solitude, where we are least alone

寒假自学1.20

flask的学习

 

 简单的做了个flask服务的页面

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新闻分类</title>
</head>
<body>
    <form action="/search-post/" method="post">

        <input type="text" name="q">
        <input type="submit" value="搜索">
    </form>

    <p>{{ rlt }}</p>
</body>
</html>
from flask import Flask, render_template

app = Flask(__name__)


@app.route('/')
def main1():

    return render_template('main.html')  # 把index.html文件读进来,再交给浏览器


if __name__ == '__main__':
    app.run()

相比django我觉得flask更加简洁

posted @ 2021-01-20 10:05  帅气的小土豆  阅读(13)  评论(0编辑  收藏  举报