server: listen on both loopback families for localhost.
Bind sockets ourselves and pass them to uvicorn (Server.serve(sockets) or the ChangeReload/Multiprocess supervisors, same API uvicorn.run uses). localhost expands to 127.0.0.1 and ::1 so clients reach the server regardless of how localhost resolves; individual bind failures degrade with a warning. Reload mode now serves all endpoints instead of only the first, multi-endpoint configs no longer run lifespan twice, and unix sockets are cleaned up on exit.
This commit is contained in:
@@ -57,7 +57,7 @@ Dev-mode behavior with `FastAPI(debug=True)`: requests error HTTP 409 with a mes
|
||||
|
||||
## Server runner
|
||||
|
||||
When you need more flexibility than `fastapi` CLI can provide (e.g. CLI arguments to your own program), you may use this convenience to run FastAPI app with Uvicorn startup on given `listen` endpoints. Runs in the same process if possible but delegates to `uvicorn.run()` for auto-reloads and multiple workers. This would typically be called from your CLI main, which can set its own env variables to pass information to the FastAPI instances that run (Python imports only work in same-process mode).
|
||||
When you need more flexibility than `fastapi` CLI can provide (e.g. CLI arguments to your own program), you may use this convenience to run FastAPI app with Uvicorn startup on given `listen` endpoints. Runs in the same process if possible but delegates to uvicorn supervisors for auto-reloads and multiple workers. `localhost` binds both 127.0.0.1 and ::1, so the server stays reachable regardless of how the name resolves. This would typically be called from your CLI main, which can set its own env variables to pass information to the FastAPI instances that run (Python imports only work in same-process mode).
|
||||
|
||||
```python
|
||||
from fastapi_vue import server
|
||||
|
||||
Reference in New Issue
Block a user