Replies: 4 comments 1 reply
-
I think the description of the project is quite straight-forward:
Given this statement, Granian has – and will have in the future – the same scope of projects like Gunicorn, Uvicorn, Hypercorn, etc. For instance, you can write a Python app which serves static files using Granian and the RSGI protocol in a few lines of code, eg: import os
async def app(scope, protocol):
path = scope.path.removeprefix("/")
if not path:
return protocol.response_empty(404)
file_path = os.path.join(os.getcwd(), path)
if not os.path.exists(file_path):
return protocol.response_empty(404)
headers = some_function_to_get_content_type_and_len_from_file(file_path)
protocol.response_file(200, headers, file_path) While I'm not sure about a use-case for "rewrite rules".
Well, RSGI born with a couple of intents, specifically:
I'm not sure about the adoption of RSGI, since it's both very specific and new; let's say at the moment is not in the project goals to spread RSGI popularity, but rather evolving the standard based on the need of Granian itself. |
Beta Was this translation helpful? Give feedback.
-
Most pre-async python appservers strongly discourage direct http termination/exposure without reverse proxy. The use case for both features is deploying SPAs with python backend. I'm evaluating options to move away from uWSGI (know it's a very opinioned kitchen-sink and i'm not suggesting going there.) since i want ASGI and async. Serving statics with python seems like waste. I will just stick with nginx. |
Beta Was this translation helpful? Give feedback.
-
Anyway, if you can provide some "real-world" use cases for both features, so we can write down an idea of the implementation, I can consider adding such features to Granian. It might be useful for several people out there. |
Beta Was this translation helpful? Give feedback.
-
Serving static files in most Python servers/web frameworks just performs very poorly, Nginx probably will outperform any current Python solution for this, but is great in the development mode for simplicity, in production mode always using something like Nginx is recommended basically in any language. Granian can add a file extension to ASGI/WSGI to help serve files, but I do not see why it is worth it. @gi0baro I see RSGI as a great opportunity to show how inefficient is ASGI, that's why I also working in something like RSGI for my project, just want to push the boundaries of Python performance up and up. |
Beta Was this translation helpful? Give feedback.
-
Hey, just wondering about the scope and long term goals.
Since there is TLS termination i assume this is designed in way that this can be run on the edge (without reverse proxy or other servers in front).
If that is the case would you consider adding:
Also could you expand on goals and differences between ASGI/RSGI?
Have you voiced your concerns with ASGI people?
Beta Was this translation helpful? Give feedback.
All reactions