Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

759
Views
The --reload flag should not be used in production on Windows. Uvicorn server warning

I run uvicorn main:app --reload to start a server for Fastapi. the server is running but I can see a warning at the console that is

WARNING:  The --reload flag should not be used in production on Windows.

For Fast API my code is

    from fastapi import FastAPI
    from fastapi.middleware.cors import CORSMiddleware


    app = FastAPI()


    origins = ["https://localhost:8080"]

    app.add_middleware(
      CORSMiddleware,
      allow_origins=origins,
      allow_credentials=True,
      allow_methods=["*"],
      allow_headers=["*"])

    @app.get("/")
    def create_todo():
      return {"Ping":"Pong"}

I want to know that Why I am seeing that... what is the reason to see this warning...

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

As per FastAPI documentation:

Warning

Remember to remove the --reload option if you were using it.

The --reload option consumes much more resources, is more unstable, etc.

It helps a lot during development, but you shouldn't use it in production.

Thus, FastAPI displays that warning as a reminder to you not to use --reload in production.

over 4 years ago · Santiago Trujillo Report

0

There are multiple "stages" that we usually talk about in how an application is used (development, testing, staging, production, etc.); in this case, only development and production is relevant.

development refers to you (the developer) running the application on your own computer and actively developing the application. In this situation using --reload is perfectly fine - it's the usage it is intended for! It's also the use case when it's actually useful, since the code changes as you develop your application and write code.

production refers to the stage where your application is made available to other people, usually in a secondary location - on a server or some other service - where the code doesn't actively change any longer (just after you've made your changes and decided that it's time to update the application version that other people see and use).

When you deploy your application to production the code doesn't actively change while the application is running - you develop on your own computer, but on the server code doesn't change before you upload or deploy it to the server. Changing the code at that stage is a more deliberate decision, and when that happens, you restart the application manually after you've deployed the new code. In that case running with the --reload flag just add unnecessary overhead, since the server has to watch all the files in the application for changes - changes that never happen.

This is particularly the case on Windows if the number of files are high, and therefor the message mentions Windows explicitly. I'd skip using it on other platforms as well, but the performance hit isn't as large there.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!