logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

python后端框架FastAPI使用建议

Ref: ------# FastAPI```bash``````bash``````toml``````bash``````python):``````python):``````python``````python``````pythonname: str``````python``````python。

#fastapi
django debug toolbar 不显示

python3.6+django2.0,安装了django-debug-toolbar,根据官方文档配置之后却没看到调试栏,增加了SHOW_TOOLBAR_CALLBACK字段后才显示settings文件末尾:if DEUBG:# django debug toolbarINSTALLED_APPS.append('debug_toolbar')MIDD...

fdfs_client.exceptions.ResponseError: Tracker response length is invaild, expect: 40, actual: 70

FastDFS的版本是最新的6.12(截至2024.05.15)升级成功后,重新执行代码,发现已经不再报错,能正常上传文件了。(需要Python3.10+)方案一:升级依赖包(

文章图片
#python#开发语言
github双因子认证

最近换了个安卓手机,打算让之前的苹果手机退役了,所以需要重新搞GitHub的Two-factor authentication。然后把手机APP里显示的六位数字,输入到xxxxxx的位置,在点击save按钮,就可以了。2. 点击Authenticator app右侧按钮。3. 下载腾讯身份验证器,点击二维码激活。4. 扫描网页上的二维码。

文章图片
#github
使用mirror.ghproxy.com加速raw.githubusercontent.com以解决brew upgrade python@3.12慢的问题

MacOS系统上,升级python3.12时,超级慢,而且最后还失败了。看了日志,发现是用curl从raw.githubusercontent.com上下载Python安装包超时了。解决方案:使用https://mirror.ghproxy.com/加速raw.githubusercontent.com。

文章图片
#python#开发语言
django-import-export 导出中文表头

models.pyclass Author(models.Model):name = models.CharField('姓名', max_length=30)class Book(models.Model):name = models.CharField('书名', max_length=120)author = models.ForeignKey(Author, verbose_name='作

#django#python
ubuntu20安装mongodb

方法一:直接安装(mongo官网) 方法二:使用docker镜像

文章图片
#mongodb#数据库
tortoise-orm在fastapi的lifespan中访问数据库表时报for r in self._routers:TypeError: ‘NoneType‘ object is not it

注:pip安装时如果报443连接超时,可以用ssh的方式(本地公钥需配置到github里):pip install --upgrade 'git+ssh://git@github.com/tortoise/tortoise-orm.git'解决:升级tortoise-orm使用github上的待发布版。如果还想消除warnning提示,可参照库文档的示例修改代码。升级完成后,不再报错了。

文章图片
#fastapi#python
poetry导出requirements.txt

命令如下:poetry export --with=dev --without-hashes -o dev_requirements.txt

文章图片
#linux#运维#服务器
pip换源、poetry换源、pdm换源、uv换源

pip、poetry换源--采用Python脚本实现,一行命令随意切换各种国内源

文章图片
#pip#python
    共 16 条
  • 1
  • 2
  • 请选择