
web开发
SooKie_p
D
展开
-
接收请求地址下载并输出文件流实现
后端下载文件处理为文件流记录原创 2023-10-16 17:22:31 · 264 阅读 · 0 评论 -
TypeError: object list can‘t be used in ‘await‘ expression
object list can't be used in 'await' expression 异常解决原创 2023-09-08 19:57:22 · 2668 阅读 · 0 评论 -
列表list中字符串输出整形int
记录场景:nub = "1,5,25"nub_type = nub.split(",")需求 – 输出整形:# 最简单的方法就是for定义的变量product_id = [int(n) for n in nub_type]# The second, lambda输入n,输出int(n)product_id = list(map(lambda n: int(n), nub_type))# The thirdproduct_id = list(map(int, nub_type))原创 2021-05-18 19:46:00 · 329 阅读 · 0 评论 -
运行报错 SyntaxError: Non-ASCII character '\xe8' in file
项目环境是 Python2.7报错信息SyntaxError: Non-ASCII character '\xe8' in file D:/Python_code/Demo/demo2.py on line 8, but no encoding declared; see for details解决方法因为注释出现出现了中文,文件格式编码出现了问题,认为存在着非法的ASCII字符在代...原创 2019-10-17 14:16:24 · 1466 阅读 · 0 评论 -
开发更换源到国内镜像!
开发因为网速等安装是件令人狂躁的事情,写篇关于更改源的文章!网速对比如下图:指定国内源后:国内一些镜像地址清华大学: https://pypi.tuna.tsinghua.edu.cn/simple/豆瓣(douban):http://pypi.douban.com/simple/阿里云: https://mirrors.aliyun.com/pypi/simple/中国科技大学:...原创 2019-10-17 10:30:10 · 837 阅读 · 1 评论 -
RuntimeError: Working outside of request context. Flask请求上下文之外
写好装饰器,项目运行BUG解决方法!BUG描述:RuntimeError: Working outside of request context.This typically means that you attempted to use functionality that neededan active HTTP request. Consult the documentation...原创 2019-08-27 14:46:36 · 6353 阅读 · 3 评论 -
ubuntu18.04安装mongo环境配置及遇到BUG!
因项目需要使用MongoDB数据库,安装到配置遇到很多问题,花费了一上午时间,在脑细胞大量付出的情况下顺利解决!MongoDB官网下载地址https://docs.mongodb.com/manual/Ubuntu中安装与配置Ubuntu18.04版本直接输入MongoDB的安装命令会出现一个问题sudo apt-get install mongodb 输入Mongo进不...原创 2019-08-12 12:06:46 · 435 阅读 · 0 评论 -
Liunx设置Python版本的默认运行环境!
Ubuntu18.04版本的Python运行环境是默认2.x版本,运行项目设置是颇为不便,需求:修改为3.x版本!解决方法:修改默认配置为3.x版本:sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150切换回2.x版本:sudo update-alternatives --con...原创 2019-08-15 13:50:39 · 388 阅读 · 0 评论 -
JWT 认证机制
JWT认证机制: 做为目前前后端分离开发中用户身份认证最流行一种解决方案,叙述一下我的理解,以供参考。Session 的优缺点:缺点:session信息存在服务器,如果用户登录过多,会过多占用服务器存储空间。session依赖于cookie,如果cookie被利用,可能会产生CSRF跨站请求伪造。对于分布式的网站应用,如果session是存在服务器内存中,session共享会成为问题。...原创 2019-05-26 15:03:02 · 306 阅读 · 0 评论 -
接受前端数据进行转换!
需求1.接受前端传递的数据转化为字典,后端使用参数去请求任意接口。解决办法:json 中的 loads函数For exampleimport jsonclass GoodsListView(View): def get(self, request): ……… demo_str = '{"status": "ok"}' demo_json = json.loads...原创 2019-05-25 16:26:00 · 868 阅读 · 0 评论