News for hackers. Stuff that matters.
Re:Granian – a Rust HTTP server for Python applications by lucideer on Monday January 16, 2023 @10:59AM (#34401925)
> If you're doing Python web development and you have no idea what WSGI or ASGI are

ASGI may be new to some, but... how is it possible to do Python web development without first learning what WSGI is? I haven't done much Python dev but WSGI seems to be the standard way - what's the less optimal alternative that people might end up with?

Re:Granian – a Rust HTTP server for Python applications by dec0dedab0de on Monday January 16, 2023 @11:44AM (#34402454)
There were other solutions 10+ years ago, but they're all dead. I guess the comment you're replying to was nervous because when people do python things in another language they sometimes don't follow python standards.
Re:Granian – a Rust HTTP server for Python applications by giancarlostoro on Tuesday January 17, 2023 @12:19AM (#34409403)
Spot on! Sometimes even in Python people reinvent the wheel because they either had no idea something existed already, or they didn't like it for whatever reason. It also means writing your web framework differently depending on how their unique solution works, it does look like they did roll some enhancements over ASGI (they extended the spec) but the fact it still supports regular Python standards is good enough in my eyes.
Re:Granian – a Rust HTTP server for Python applications by linsomniac on Monday January 16, 2023 @01:05PM (#34403540)
I assume the situation would be that you are just following a FastAPI or Django or Flask tutorial and putting the pieces together, running gunicorn without really even thinking about WSGI.
Re:Granian – a Rust HTTP server for Python applications by beltsazar on Monday January 16, 2023 @01:11PM (#34403608)
> how is it possible to do Python web development without first learning what WSGI is?

You'll be surprised to find out that there are many software developers who are "fast learners", but actually are shallow learners. Or to put it more kindly, they are not-so-curious learners, i.e. they only learn just enough things they need to accomplish the task at the moment. It's not necessarily a bad trait; but sometimes if you don't learn the fundamentals, it will cost you more (time, effort) along the way.

Re:Granian – a Rust HTTP server for Python applications by vore on Monday January 16, 2023 @02:02PM (#34404226)
I think it depends how deep into the fundamentals you want to go. If you're building say a shopping cart extension for Django, your time is better spent building within the framework than learning the nitty gritty of WSGI. It's a cost-time trade off and sometimes learning the fundamentals is not worth it when you could be spending more time on working on your actual problem domain.
Re:Granian – a Rust HTTP server for Python applications by giancarlostoro on Tuesday January 17, 2023 @12:17AM (#34409398)
I would not be surprised how many Django developers setup WSGI and still have no idea how it works or why it exists, they just pull up a Google article on best practices for deploying Django and follow it to the T.
Re:Granian – a Rust HTTP server for Python applications by cturner on Monday January 16, 2023 @01:14PM (#34403655)
Over the years, I have built some internal apps by nesting aiohttp in a python process. Usually this starts with me having an existing process and finding I want to add a web interface to it, for example, as a dashboard. What would be the advantage of putting a commodity web server between the application server and the user, rather than having the user’s browser directly talk to aiohttp?
Re:Granian – a Rust HTTP server for Python applications by berkle4455 on Monday January 16, 2023 @02:58PM (#34404797)
> how is it possible to do Python web development without first learning what WSG

A vast majority of people who call themselves "python devs" got there by copy-pasting ML scripts from stackoverflow (and now chatGPT) into jupyter notebooks.

Re:Granian – a Rust HTTP server for Python applications by whatever1 on Monday January 16, 2023 @07:24PM (#34407493)
That is fine, you don’t have to understand the underlying libraries to write useful code.
Re:Granian – a Rust HTTP server for Python applications by detaro on Tuesday January 17, 2023 @12:19AM (#34409406)
It's in the end an implementation detail. You can set up a WSGI server and deploy an app without really knowing or understanding what WSGI actually is, even if the letters appeared somewhere deep in a config file.
Re:Granian – a Rust HTTP server for Python applications by lucideer on Tuesday January 17, 2023 @01:34PM (#34416611)
This comment is long past editing deadline but since most replies seem to have misinterpreted me, I must have worded it very badly, so will clarify:

Basic tutorials for Python newbies use wsgi. Copying & pasting from SO without understanding the code you're copying will inadvertently net you a wsgi setup. FastAPI requires wsgi.

I wasn't stating that everyone deploying Python has a depth of knowledge of wsgi - I was enquiring as to whether there's some other alternative system people pervasively use for Python web apps, as I assumed everyone was on wsgi (whether they're aware of it or not).

TL;DR: by "learning what wsgi is" I just meant "deploying it" not "understanding it in depth"