new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

FastAPI · all subjects

architecture

72 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

fastapi run command for production

Use the command `fastapi run` to start FastAPI in production mode. Auto-reload is disabled by default and the server listens on 0.0.0.0 (all available IP addresses).

FastAPI CLI uses Uvicorn

The FastAPI CLI internally uses Uvicorn, a powerful, production-ready ASGI server.

Default app detection by FastAPI CLI

The FastAPI CLI automatically detects the FastAPI app to run, assuming an object named `app` in a file called `main.py` by default, with a few other variants also supported.

Configure app entrypoint in pyproject.toml

Configure the FastAPI app location in a `pyproject.toml` file using `[tool.fastapi]` section with an `entrypoint` key, for example: `entrypoint = "main:app"` or `entrypoint = "backend.main:app"`.

fastapi dev --entrypoint CLI option

You can pass the `--entrypoint` option to the `fastapi dev` command to explicitly specify the app, for example: `fastapi dev --entrypoint main:app`.

fastapi dev with file path argument

You can pass a file path to the `fastapi dev` command to specify which app to run, for example: `fastapi dev main.py`. The CLI will infer the FastAPI app object from that file.

fastapi dev auto-reload behavior

The `fastapi dev` command has auto-reload enabled by default, which automatically restarts the server when you make changes to your code. This is resource-intensive and less stable than with auto-reload disabled, so it should only be used for development.

fastapi dev listens on localhost

The `fastapi dev` command listens on IP address 127.0.0.1 by default, which is localhost and only allows communication with the local machine.

fastapi run listens on all IP addresses

The `fastapi run` command listens on IP address 0.0.0.0 by default, which means all available IP addresses, making it publicly accessible to anyone who can communicate with the machine.

fastapi dev server output shows documentation URL

When running `fastapi dev`, the server starts at http://127.0.0.1:8000 and documentation is available at http://127.0.0.1:8000/docs.

Configure entrypoint in pyproject.toml for tool integration

Using the `entrypoint` configuration in `pyproject.toml` is recommended because other tools can find it, such as the VS Code Extension or FastAPI Cloud, and you don't have to remember to pass the correct path each time you invoke a `fastapi` command.

Production deployment requires termination proxy for HTTPS

In most production cases, you should have a termination proxy that manages HTTPS for you. This depends on how you deploy your application—your provider may handle it or you may need to set it up yourself.

Give your agent this brain