this post was submitted on 04 Feb 2025
13 points (100.0% liked)

Python

6684 readers
5 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

MicroPie is a small and very fast Python web framework. It is designed with flexability and simplicity in mind. Check out the website or the GitHub project.


from MicroPie import App  

class MyApp(App):  

    async def index(self):  
        return 'Hello ASGI World!'  

app = MyApp()  # Run with `uvicorn app:app`  
you are viewing a single comment's thread
view the rest of the comments
[–] logging_strict@programming.dev 1 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

What's the difference between running uvicorn vs nginx?

Yes could just do a web search, but would like to hear the OP's perspective

[–] harrisonerd@piefed.social 4 points 2 weeks ago (1 children)

Uvicorn and nginx are two completely different things in your web stack. For production, you typically don't expose Uvicorn directly to the public. Instead, nginx receives all traffic, serves static assets efficiently, and forwards dynamic requests to Uvicorn. Uvicorn's website explains each components role in your stack: "Using Nginx as a proxy in front of your Uvicorn processes may not be necessary, but is recommended for additional resilience. Nginx can deal with serving your static media and buffering slow requests, leaving your application servers free from load as much as possible. In managed environments such as Heroku, you won't typically need to configure Nginx, as your server processes will already be running behind load balancing proxies."

The question is not "What's the difference between running uvicorn vs nginx?" But "When should I use Nginx to deploy with Uvicorn?" Hope this makes sense.

Thanks for the explanation.