V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
softerzhangyu
V2EX  ›  Python

Python 新框架讨论

  •  
  •   softerzhangyu · 125 天前 via Android · 3889 次点击
    这是一个创建于 125 天前的主题,其中的信息可能已经有所发展或是发生改变。
    以前都是 flask 和 django 一把嗦,为啥现在都开始搞 fastapi 了
    18 条回复    2024-01-30 14:39:36 +08:00
    nagisaushio
        1
    nagisaushio  
       125 天前
    前后端分离吧,现在大部分后端不管前端渲染了,只写 API 的话 fastapi 还是很香的
    hanzijinjin
        2
    hanzijinjin  
       125 天前
    我用 sanic
    duke807
        3
    duke807  
       125 天前 via Android
    我用 python cgi 和 python websocket
    qloog
        4
    qloog  
       125 天前
    django-rest-framework 和 fastapi 比怎么样?

    熟悉 django 的还是用 django-rest-framework 可能更方便些。
    qloog
        5
    qloog  
       125 天前
    是因为这个么:FastAPI was designed as a fully-async web framework. It supports ASGI as standard and everything is async. 所以性能更好?
    bequt
        6
    bequt  
       125 天前
    主要还是前后端分离。
    不过独立开发者简单页面感觉 django 一把梭也舒服。
    crackidz
        7
    crackidz  
       125 天前
    @qloog 同步有 greenlet ,有些不会写或者有些库甚至会让 async 比 sync 更糟糕

    其实 FastAPI 对纯 API 开发算是 Battery included ,Django 和 Flask 还不够开箱即用。
    kuituosi
        8
    kuituosi  
       125 天前
    python 的 web 框架非常多,但是一直觉得 django 最顺手
    Jackeriss
        9
    Jackeriss  
       125 天前
    我还以为又出啥新框架了,fastapi 都多少年了。。
    Nile20
        10
    Nile20  
       125 天前
    我写一些自用的玩具项目用过 flask 和 fastapi ,体验是后者调试 API 更方便
    ltfree
        11
    ltfree  
       125 天前
    小巧 方便? 我只是写些接口而已
    DeWjjj
        12
    DeWjjj  
       125 天前
    大部分业务都只是一个数据库查询中间件+鉴权系统。
    fastapi 能负责这一业务当然最好。
    ytmsdy
        13
    ytmsdy  
       125 天前
    我一直都是直接用 Django ,后端大概率还是需要提供管理后台的。Django 自带管理后台,方便很多。
    leeg810312
        14
    leeg810312  
       125 天前
    可能 flask/django 的认知度已经足够高了,这些年 fastapi 看上去社区推广做得很卖力
    coreki
        15
    coreki  
       124 天前
    一直在用 flask ,只写后端 api ,开新项目拿以前项目改改就能用,不想学新的了
    fzzff
        16
    fzzff  
       124 天前
    @qloog 得综合需求来看吧, 这两个框架我都在用, 写 C 端项目的时候大部分接口并不是增删改查这时候 drf 跟项目的贴合度就没那么高, 自带的 ModelViewSet 基本也用不上, 这时候用 fastapi 就舒服很多, 当然也可以用 django-ninja, 不过 django 对异步的支持不好就不如直接用 fastapi 了
    zywscq
        17
    zywscq  
       115 天前
    FastApi 对新手比较友好
    xhatt510
        18
    xhatt510  
       88 天前
    FastApi 感觉更加现代化,函数签名写好,生成接口文档+参数校验真的很香。但是对依赖的库有一定要求。毕竟一个同步就能阻塞了。我如果自己做项目,我会选 fastapi
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1102 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:15 · PVG 02:15 · LAX 11:15 · JFK 14:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.