MicroPie - "ultra-micro" ASGI web framework
from harrisonerd@piefed.social to python@programming.dev on 04 Feb 2025 22:40
https://piefed.social/post/456278

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`  

#asgi #async #framework #http #python #web

threaded - newest

logging_strict@programming.dev on 06 Feb 2025 06:18 collapse

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 on 06 Feb 2025 15:19 collapse

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.

logging_strict@programming.dev on 07 Feb 2025 02:35 collapse

Thanks for the explanation.