随笔分类 -  flask

摘要:1, 简单版 # -*- coding: utf-8 -*- from flask import Flask from flask_restful import reqparse, abort, Api, Resource app = Flask(__name__) api = Api(app) c 阅读全文
posted @ 2021-04-15 16:41 ty1539 阅读(109) 评论(0) 推荐(0) 编辑
摘要:main.py from flask import Flask from flask import request from flask import render_template from flask import redirect from model import * # app=Flask 阅读全文
posted @ 2021-04-14 23:55 ty1539 阅读(91) 评论(0) 推荐(0) 编辑
摘要:#_*_coding:utf-8_*_ from flask import Flask from flask_mail import Mail,Message app = Flask(__name__) # 配置邮件:服务器/端口/传输层安全协议/邮箱名/密码 app.config.update( 阅读全文
posted @ 2021-04-14 23:47 ty1539 阅读(55) 评论(0) 推荐(0) 编辑
摘要:pyhton manage.py runserver -h 0.0.0.0 -p 8888 #_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, render_template, request f 阅读全文
posted @ 2021-04-14 23:44 ty1539 阅读(66) 评论(0) 推荐(0) 编辑
摘要:flask的orm的原始方法 #_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, render_template, request from flask_sqlalchemy import SQL 阅读全文
posted @ 2021-04-14 23:26 ty1539 阅读(112) 评论(0) 推荐(0) 编辑
摘要:1, 何谓表单? 表单是HTML页面中负责数据采集功能的部件。它往往由三个部分组成,即表单标签、表单域、表单按钮。我们可以通过表单,将用户输入的数据提交给服务端,并交由服务端进行处理。 表单标签 用于声明表单的范围,位于表单标签中的元素将被提交 语法:<form></form> 属性:Method, 阅读全文
posted @ 2021-04-14 11:08 ty1539 阅读(342) 评论(0) 推荐(0) 编辑
摘要:是不是每次调整模板文件,就要停止flask服务器,重启flask服务器,再去浏览器刷新页面? 有没有办法自动完成这3步呢? 安装livereload即可, 仅仅把app.run() 改为下面的例子就可以了。 注意:现在只支持python3.7,不支持3.8,并且尽限于修改模板文件,或者静态文件,改p 阅读全文
posted @ 2021-04-13 17:37 ty1539 阅读(1312) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2020/4/6 from flask.views import View from flask import Flask, render_template, request,views,jsonify app = 阅读全文
posted @ 2021-04-13 16:29 ty1539 阅读(67) 评论(0) 推荐(0) 编辑
摘要:from flask import Flask,flash,render_template,request app = Flask(__name__) app.secret_key ='123' # 此处一定要有app.secret_key, 至于为什么还没搞明白 @app.route('/') d 阅读全文
posted @ 2021-04-13 11:20 ty1539 阅读(124) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 # Flask依赖一个实现wsgi协议的模块:werkzeug from werkzeug.wrappers import Request,Response @Request.applicati 阅读全文
posted @ 2021-04-13 10:28 ty1539 阅读(56) 评论(0) 推荐(0) 编辑
摘要:# coding:utf-8 def num_div(num1,num2): try: assert isinstance(num1,int) except AssertionError: print(num1,'num1不是int类型') try: assert isinstance(num2,i 阅读全文
posted @ 2021-04-13 10:18 ty1539 阅读(59) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, render_template, request, url_for, redirect from flask_sqlalchemy import 阅读全文
posted @ 2021-04-12 23:22 ty1539 阅读(77) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, request # from werkzeug.routing import BaseConverter app = Flask(__name_ 阅读全文
posted @ 2021-04-12 23:18 ty1539 阅读(1446) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, request, abort, Response, make_response # from werkzeug.routing import B 阅读全文
posted @ 2021-04-12 23:15 ty1539 阅读(784) 评论(0) 推荐(0) 编辑
摘要:文件夹如下 文件: python进行cgi编程/cgi-bin/main.py #!/usr/bin/env python import cgi,cgitb from jkxy import * form1 = cgi.FieldStorage() num1=form1.getvalue("Num1 阅读全文
posted @ 2021-04-12 23:09 ty1539 阅读(587) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, url_for, current_app, redirect from werkzeug.routing import BaseConverte 阅读全文
posted @ 2021-04-12 22:56 ty1539 阅读(67) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, render_template, request from flask_sqlalchemy import SQLAlchemy app = F 阅读全文
posted @ 2021-04-12 22:50 ty1539 阅读(48) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, render_template, request app = Flask(__name__) @app.route('/index') def 阅读全文
posted @ 2021-04-12 22:40 ty1539 阅读(60) 评论(0) 推荐(0) 编辑
摘要:flask_script用法: #_*_ encoding: utf-8 _*_ @author: ty hery 2019/1/12 from flask_script import Manager from flask import Flask import sqlite3 app = Flas 阅读全文
posted @ 2021-04-12 22:29 ty1539 阅读(112) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/12/20 from flask import Flask, session, current_app, g # g 是临时的本App里面的变量对象,通过对象的方法保存数据 如 g.username='张三 阅读全文
posted @ 2021-04-12 22:20 ty1539 阅读(73) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示