Coder Social home page Coder Social logo

Comments (8)

ermarkar avatar ermarkar commented on September 23, 2024 3

I have tried

uvicorn.run(self.app, host=host, port=port, debug=True)

and this

uvicorn.run(self.app, host=host, port=port, reload=True)

not working in VSCode

from uvicorn-gunicorn-fastapi-docker.

rudmac avatar rudmac commented on September 23, 2024 2

just create a env GUNICORN_CMD_ARGS="--reload"

http://docs.gunicorn.org/en/stable/settings.html#reload

or you can insert into gunicorn-conf.py

reload = True

from uvicorn-gunicorn-fastapi-docker.

wshayes avatar wshayes commented on September 23, 2024

Aarrgghhh! Yes that works great - read somewhere that didn’t work and didn’t test it. Shame on me.

Thanks!

Thanks also for the env tip - works great with Docker compose.

from uvicorn-gunicorn-fastapi-docker.

tiangolo avatar tiangolo commented on September 23, 2024

@wshayes

Great project and thanks!

Awesome! I'm glad it's working for you.

@rudmac Thanks for your help here! It's very appreciated. 👏 🌮


There's a new integrated script /start-reload.sh specifically for this.

It runs only Uvicorn with --reload, optimal for development.

Check the updated docs here: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#development-live-reload

from uvicorn-gunicorn-fastapi-docker.

wshayes avatar wshayes commented on September 23, 2024

Thanks - I'll update the writeup I made for it: https://medium.com/@williamhayes/fastapi-starlette-debug-vs-prod-5f7561db3a59 (future note for myself (ever searched for a solution to a problem and find an old post with the answer - still undecided if it is embarrassing or an example of impressive forethought))

FYI - looks like --reload and --debug are equivalent currently in uvicorn. I'll make a note of that as well.

from uvicorn-gunicorn-fastapi-docker.

tiangolo avatar tiangolo commented on September 23, 2024

Thanks! And great post!

In Uvicorn, --debug was the "standard" up to 0.5.0, now it will be --reload, it's very recent.

Check: fastapi/fastapi#66

from uvicorn-gunicorn-fastapi-docker.

mironnn avatar mironnn commented on September 23, 2024

Can reloading be working without a gunicorn?

from uvicorn-gunicorn-fastapi-docker.

wshayes avatar wshayes commented on September 23, 2024

Can reloading be working without a gunicorn?

Not easily without either uvicorn or gunicorn. It's possible to replicate reload without it, but you still need an ASGI server to run FastAPI anyway.

from uvicorn-gunicorn-fastapi-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.