SHORTLIST20
中文
Englishالعربية中文日本語한국어EspañolFrançaisहिन्दी
编程

前 20 Python Web 与 API 框架

Django, Flask, FastAPI and the rest, from full-stack sites to REST and GraphQL APIs

更新于 · GitHub stars (stars)

为什么是这20个

Ranked by GitHub stars: how many developers bookmarked the project. Stars measure attention, not quality, so each row also shows forks, licence, the last push and the section of the community list it sits in. Full-stack frameworks (Django, Flask) and API toolkits that sit on top of them (Django REST framework, flask-restx) are in one list, so the 'listed under' column says which kind each one is. Older frameworks collected stars for longer than new ones like Litestar or FastHTML.

这份清单有用吗?
  1. 1

    fastapi

    A modern, fast web framework for building APIs with standard Python type hints.

    105,115 stars 10,419 forkslast push 2026-11-24PythonMIT

  2. 2

    django

    A high-level web framework that encourages rapid development and clean, pragmatic design.

    91,839 stars 35,008 forkslast push 2026-11-30PythonBSD-3-Clause

  3. 3

    flask

    A microframework for Python.

    75,310 stars 17,316 forkslast push 2026-10-30PythonBSD-3-Clause

  4. 4

    django-rest-framework

    A powerful and flexible toolkit to build web APIs.

    30,298 stars 7,109 forkslast push 2026-11-26PythonNOASSERTION

  5. 5

    reflex

    A framework for building reactive, full-stack web applications entirely with Python.

    29,054 stars 1,845 forkslast push 2026-11-30PythonApache-2.0

  6. 6

    tornado

    A web framework and asynchronous networking library.

    22,181 stars 5,633 forkslast push 2026-11-30PythonApache-2.0

  7. 7

    starlette

    A lightweight ASGI framework and toolkit for building high-performance async services.

    12,800 stars 1,476 forkslast push 2026-11-30PythonBSD-3-Clause

  8. 8

    django-ninja

    Fast, Django REST framework based on type hints and Pydantic.

    9,259 stars 625 forkslast push 2026-11-17PythonMIT

  9. 9

    bottle

    A fast and simple micro-framework distributed as a single file with no dependencies.

    8,804 stars 1,514 forkslast push 2026-11-28PythonMIT

  10. 10

    litestar

    Production-ready, capable and extensible ASGI web framework.

    8,573 stars 696 forkslast push 2026-11-30PythonMIT

  11. 11

    fasthtml

    The fastest way to create an HTML app.

    7,060 stars 327 forkslast push 2026-11-30Jupyter NotebookApache-2.0

  12. 12

    strawberry

    A GraphQL library that leverages Python type annotations for schema definition.

    4,733 stars 694 forkslast push 2026-11-30PythonMIT

    也在: #2 FastAPI extensions

  13. 13

    connexion

    A spec-first framework that handles requests based on your OpenAPI specification.

    4,614 stars 793 forkslast push 2026-11-15PythonApache-2.0

    也在: #6 Flask extensions

  14. 14

    pyramid

    A small, fast, down-to-earth, open source Python web framework.

    4,108 stars 898 forkslast push 2026-11-27PythonNOASSERTION

  15. 15

    flask-restx

    Fully featured framework for fast, easy and documented API development with Flask.

    2,225 stars 351 forkslast push 2026-04-14PythonNOASSERTION

    也在: #11 Flask extensions

  16. 16

    django-modern-rest

    Modern REST with speed, types, async,, and other goodies.

    1,572 stars 242 forkslast push 2026-11-30PythonMIT

  17. 17

    apiflask

    A lightweight Python web API framework based on Flask, supporting marshmallow schemas and Pydantic models.

    1,139 stars 150 forkslast push 2026-11-28PythonMIT

    也在: #17 Flask extensions

  18. 18

    flask-smorest

    A Flask/Marshmallow-based REST API framework with automatic OpenAPI documentation.

    716 stars 80 forkslast push 2026-11-04PythonMIT

  19. 19

    strawberry-django

    Strawberry GraphQL integration with Django.

    505 stars 158 forkslast push 2026-11-28PythonMIT

并排比较

LicencePlatformsWhat it doesPython versionsAsync supportPlugins and ecosystemBest forType hints
fastapiMIT License–––––––
djangoBSD 3-Clause License–––––––
flaskBSD 3-Clause License–––––––
django-rest-frameworkBSD 3-Clause LicenseCross-platform (Linux, macOS, Windows)Toolkit for building flexible, browsable RESTful APIs in Django.Python 3.8+Primarily synchronous WSGI execution; limited async support via Django.Vast ecosystem of third-party plugins for authentication, filtering, and OpenAPI.Robust RESTful web APIs integrated into existing Django applications.–
reflexApache 2.0 LicenseCross-platform (Linux, macOS, Windows)Full-stack framework for building reactive web applications purely in Python.Python 3.8+Native async event handlers, background tasks, and async state mutations.Extensive library of wrapped React components and custom Python components.Full-stack applications, dashboards, and internal tools built without JavaScript.Strongly typed state definitions and event handlers using Python typing.
tornadoApache 2.0 LicenseCross-platform (Linux, macOS, Windows)Asynchronous web framework and networking library for high-concurrency non-blocking I/O.Python 3.8+Native non-blocking asynchronous event loop with coroutine and WebSocket support.Integrates with standard asyncio libraries, WSGI adapters, and tornadoweb extensions.Real-time applications, WebSockets, long polling, and high-concurrency network servers.Fully typed codebase across public interfaces and coroutine signatures.
starletteBSD 3-Clause LicenseCross-platform (Linux, macOS, Windows)Lightweight ASGI framework and toolkit for building high-performance async services.Python 3.8+Native ASGI async/await design for HTTP, WebSockets, and background tasks.Core ASGI middleware ecosystem, AnyIO compatibility, and community middleware components.High-performance async microservices and foundation toolkit for ASGI frameworks.Fully typed codebase with comprehensive annotations across all components.
django-ninjaMIT LicenseCross-platform (Linux, macOS, Windows)Fast REST framework for Django powered by Python type hints and Pydantic.Python 3.7+Supports both synchronous and asynchronous view functions and async ORM.Integrates with Django apps, Pydantic plugins, and Django Ninja Extra.Fast, type-safe REST APIs within Django applications using Pydantic schemas.Type hints are core; used for request validation and OpenAPI schemas.
bottleMIT LicenseCross-platform (Linux, macOS, Windows)Fast, lightweight WSGI microframework distributed as a single file.Python 2.7 and 3.6+Synchronous WSGI; async execution possible via Gevent or Tornado adapters.Simple plugin system for database adapters, templating, and session handling.Small standalone web scripts, prototyping, and embedded single-file applications.Untyped codebase; does not utilize native Python type annotations.
litestarMIT LicenseCross-platform (Linux, macOS, Windows)Extensible, highly performant ASGI web framework for building typed APIs.Python 3.8+Native async/await support with full compliance for ASGI applications.Modular plugin architecture for SQLAlchemy, Picologging, and template engines.Enterprise-grade high-performance APIs, microservices, and large typed web applications.Strict, first-class type hints; supports Pydantic, msgspec, and attrs.
fasthtmlApache 2.0 License––Python 3.10+––––
strawberryMIT LicenseCross-platform (Linux, macOS, Windows)Python GraphQL library built on dataclasses and standard type annotations.Python 3.8+Native async/await support for resolvers, subscriptions, and schema execution.Integrations for FastAPI, Django, Flask, Starlette, ASGI, and custom extensions.Building type-safe GraphQL APIs and federated GraphQL schemas in Python.Core schema definitions rely entirely on standard Python type annotations.
connexionApache 2.0 LicenseCross-platform (Linux, macOS, Windows)Spec-first framework mapping OpenAPI specifications to Python endpoints with validation.Python 3.8+Native async support via AsyncApp running on Starlette and ASGI.Works with Flask, Starlette, Swagger UI, Redoc, and OpenAPI tooling.API-first, contract-driven development using OpenAPI and Swagger specifications.Supports type hints for parameter parsing, injection, and return values.
pyramidRepoze Custom License (BSD-like)–––––––
flask-restxBSD 3-Clause LicenseCross-platform (Linux, macOS, Windows)Flask extension for building REST APIs with automatic Swagger documentation.Python 3.8+Synchronous WSGI execution; follows standard Flask synchronous request lifecycle.Compatible with Flask extensions, Swagger UI, and Marshmallow serializer tools.Documented REST APIs in Flask applications needing automated Swagger UI.Uses custom field objects for data modeling rather than type hints.
django-modern-restMIT LicenseCross-platform (Linux, macOS, Windows)High-performance Django REST framework supporting types, async, and pluggable serializers.Python 3.10+Native support for both synchronous and asynchronous Django endpoints.Integrates with Pydantic, msgspec, attrs, Schemathesis, and Django ecosystem.High-speed, type-safe, and async-capable REST APIs in Django applications.Fully typed architecture leveraging Pydantic, msgspec, or attrs type annotations.
apiflaskMIT LicenseCross-platform (Linux, macOS, Windows)Flask wrapper providing request validation, serialization, and OpenAPI documentation automatically.Python 3.8+Supports asynchronous route handlers using Flask's built-in async support.Fully compatible with Flask extensions, Marshmallow ecosystem, and OpenAPI tools.OpenAPI-compliant REST APIs built with Flask and Marshmallow validation.Relies primarily on Marshmallow schemas; supports type hints in views.
flask-smorestMIT LicenseCross-platform (Linux, macOS, Windows)REST API framework combining Flask, Marshmallow, and automatic OpenAPI generation.Python 3.8+Synchronous WSGI framework relying on standard Flask request lifecycle.Deep integration with Flask, Marshmallow, Webargs, and APISpec ecosystems.Declarative REST APIs using Flask, Marshmallow schemas, and OpenAPI documentation.Relies on Marshmallow schemas for typing rather than native type hints.
strawberry-djangoMIT LicenseCross-platform (Linux, macOS, Windows)Django extension for Strawberry GraphQL generating types and queries from models.Python 3.8+Supports both synchronous and asynchronous GraphQL views and query resolvers.Works with Django ORM, Django Debug Toolbar, and Strawberry extensions.Creating optimized GraphQL APIs directly integrated with Django ORM models.Deep type hint integration converting Django models into typed GraphQL schemas.

每个单元格都来自该工具的官网、文档或代码仓库;页面列在参考资料中。

如何衡量

Every project in the Web Frameworks and Web APIs sections of the community list vinta/awesome-python on GitHub that has a public repository, ranked by GitHub stars from the GitHub API; archived repositories are left out. Refreshed every 6 hours. gRPC is left out: its repository is the whole multi-language gRPC project, so its stars aren't the Python package's.

参考资料

  1. vinta/awesome-python: Web Frameworks and Web APIs, GitHub community list (list text CC BY 4.0; star counts from the GitHub API). Checked 2026-11-30 18:33 UTC.
  2. vinta/awesome-python (Web Frameworks, Web APIs), GitHub community list, 19 tools with a public repository.
  3. fastapi: licence, github.com, checked 2026-11-15.
  4. django: licence, github.com, checked 2026-11-15.
  5. flask: licence, github.com, checked 2026-11-15.
  6. django-rest-framework: licence, github.com, checked 2026-11-15.
  7. django-rest-framework: platforms, django-rest-framework.org, checked 2026-11-15.
  8. reflex: licence, github.com, checked 2026-11-15.
  9. reflex: platforms, reflex.dev, checked 2026-11-15.
  10. reflex: what it does, reflex.dev, checked 2026-11-15.
  11. reflex: async support, reflex.dev, checked 2026-11-15.
  12. reflex: type hints, reflex.dev, checked 2026-11-15.
  13. reflex: plugins and ecosystem, reflex.dev, checked 2026-11-15.
  14. tornado: licence, github.com, checked 2026-11-15.
  15. tornado: platforms, tornadoweb.org, checked 2026-11-15.
  16. tornado: python versions, tornadoweb.org, checked 2026-11-15.
  17. tornado: async support, tornadoweb.org, checked 2026-11-15.
  18. starlette: licence, github.com, checked 2026-11-15.
  19. starlette: platforms, starlette.io, checked 2026-11-15.
  20. starlette: plugins and ecosystem, starlette.io, checked 2026-11-15.
  21. django-ninja: licence, github.com, checked 2026-11-15.
  22. django-ninja: platforms, django-ninja.dev, checked 2026-11-15.
  23. django-ninja: async support, django-ninja.dev, checked 2026-11-15.
  24. bottle: licence, github.com, checked 2026-11-15.
  25. bottle: platforms, bottlepy.org, checked 2026-11-15.
  26. bottle: async support, bottlepy.org, checked 2026-11-15.
  27. bottle: plugins and ecosystem, bottlepy.org, checked 2026-11-15.
  28. litestar: licence, github.com, checked 2026-11-15.
  29. litestar: platforms, litestar.dev, checked 2026-11-15.
  30. litestar: plugins and ecosystem, litestar.dev, checked 2026-11-15.
  31. fasthtml: licence, github.com, checked 2026-11-15.
  32. fasthtml: python versions, github.com, checked 2026-11-15.
  33. Strawberry GraphQL: licence, github.com, checked 2026-11-15.
  34. Strawberry GraphQL: platforms, strawberry.rocks, checked 2026-11-15.
  35. Strawberry GraphQL: async support, strawberry.rocks, checked 2026-11-15.
  36. Strawberry GraphQL: plugins and ecosystem, strawberry.rocks, checked 2026-11-15.
  37. Connexion: licence, github.com, checked 2026-11-15.
  38. Connexion: platforms, connexion.readthedocs.io, checked 2026-11-15.
  39. pyramid: licence, github.com, checked 2026-11-15.
  40. Flask-RESTX: licence, github.com, checked 2026-11-15.
  41. Flask-RESTX: platforms, flask-restx.readthedocs.io, checked 2026-11-15.
  42. django-modern-rest: licence, github.com, checked 2026-11-15.
  43. django-modern-rest: platforms, django-modern-rest.readthedocs.io, checked 2026-11-15.
  44. APIFlask: licence, github.com, checked 2026-11-15.
  45. APIFlask: platforms, apiflask.com, checked 2026-11-15.
  46. flask-smorest: licence, github.com, checked 2026-11-15.
  47. flask-smorest: platforms, flask-smorest.readthedocs.io, checked 2026-11-15.
  48. strawberry-django: licence, github.com, checked 2026-11-15.
  49. strawberry-django: platforms, github.com, checked 2026-11-15.