• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

Yancy00

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

上一页 1 ··· 3 4 5 6 7

2023年3月17日

flask-自定义过滤器

摘要: 自定义中文日期过滤器 在单独文件comm.py中定义过滤器函数 # 定义中文日期,时间过滤器处理函数 def chinese_date_format(value,format='%Y年%m月%d日'): return value.strftime(format) def chinese_time_f 阅读全文

posted @ 2023-03-17 09:54 Yancy00 阅读(102) 评论(0) 推荐(0)

2023年3月16日

flask-函数url_for()动态构造url

摘要: @app.route('/blog/<int:blog_id>') def blog_detail(blog_id): return f'您查找的博客ID:{blog_id}' @app.route('/urlfor') def urlfor(): res=url_for('blog_detail' 阅读全文

posted @ 2023-03-16 10:15 Yancy00 阅读(21) 评论(0) 推荐(0)

2023年3月15日

flask-页面模板渲染JinJa2

摘要: flask用 render_template()函数渲染前端页面 from flask import Flask,render_template app=Flask(__name__) @app.route('/') def index(): return render_template('inde 阅读全文

posted @ 2023-03-15 22:44 Yancy00 阅读(98) 评论(0) 推荐(0)

flask-页面重定向

摘要: 页面重定向 是指从一个页面自动跳转到另一个页面. #例如用户访问了一个需要登陆权限的页面,但是该用户当前状态并未登陆. #因此网页会重定向跳转到登陆页面 from flask import Flask,url_for,redirect app=Flask(__name__) @app.route(' 阅读全文

posted @ 2023-03-15 21:52 Yancy00 阅读(80) 评论(0) 推荐(0)

flask-快捷路由装饰器

摘要: | 快捷路由装饰器 | 等价于 | | | | | app.get('/login') | app.route('/login',methods=['GET']) | |app.post('/login') | app.route('/login'),methods=['POST' | | app. 阅读全文

posted @ 2023-03-15 21:23 Yancy00 阅读(33) 评论(0) 推荐(0)

flask-HTTP请求方式

摘要: flask中路由常用请求有GET/POST @app.route('/blog/add',methods=['GET','POST']) def add_blog(): if request.method=='GET': return '您正在通过GET请求添加博客.' return '您正在通过P 阅读全文

posted @ 2023-03-15 21:18 Yancy00 阅读(35) 评论(0) 推荐(0)

flask-URL中传参数

摘要: 用法示例: @app.route('/blog/<string:blog_id>') #装饰器上的参数1 是url.里面可以填类型 def blog_detail(blog_id): # 视图函数也要有对应类型的参数 return f'您查找的博客ID={blog_id}' URL中的参数类型 | 阅读全文

posted @ 2023-03-15 18:56 Yancy00 阅读(90) 评论(0) 推荐(0)

flask-migrate插件使用

摘要: 安装 pip install flask-migrate 代码 exts.py from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate db=SQLAlchemy() # 创建数据库连接对象 migrate= 阅读全文

posted @ 2023-03-15 12:14 Yancy00 阅读(51) 评论(0) 推荐(0)

2023年2月28日

问题[] 远程连接腾讯云服务器上的mysql

摘要: 困扰我两个月的问题终于解决啦. 问题: 腾讯云服务上的mariadb,在本地win7 连不上数据库... 用户授权.GRANT ALL PRIVILEGES ON *.* TO 'aaa'@'%' IDENTIFIED BY '123' WITH GRANT OPTION; 防火墙都关闭了. 就是连 阅读全文

posted @ 2023-02-28 12:12 Yancy00 阅读(18) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3