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更加简洁