The current page still doesn't have a translation for this language.
But you can help translating it: Contributing.
本教程将一步步向你展示如何使用 FastAPI-Channels 的绝大部分特性。
各个章节的内容循序渐进,但是又围绕着单独的主题,所以你可以直接跳转到某个章节以解决你的特定需求。
本教程同样可以作为将来的参考手册。
你可以随时回到本教程并查阅你需要的内容。
运行代码
所有代码片段都可以复制后直接使用(它们实际上是经过测试的 Python 文件)。
要运行任何示例,请将代码复制到 main.py 文件中,然后使用以下命令启动 fastapi:
fast →fastapi dev main.pyINFO Using path main.py INFO Resolved absolute path /home/user/code/awesomeapp/main.py INFO Searching for package file structure from directories with __init__.py files INFO Importing from /home/user/code/awesomeapp
INFO Importing module main INFO Found importable FastAPI app
╭─ Importable FastAPI app ─╮ │ │ │ from main import app │ │ │ ╰──────────────────────────╯
INFO Using import string main:app ╭────────── FastAPI CLI - Development mode ───────────╮ │ │ │ Serving at: http://127.0.0.1:8000 │ │ │ │ API docs: http://127.0.0.1:8000/docs │ │ │ │ Running in development mode, for production use: │ │ │ │ fastapi run │ │ │ ╰─────────────────────────────────────────────────────╯ INFO: Will watch for changes in these directories: ['/home/user/code/awesomeapp'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [2265862] using WatchFiles INFO: Started server process [2265873] INFO: Waiting for application startup. INFO: Application startup complete.