Simple webserver

Frank Millman frank at chagford.com
Wed Oct 25 03:57:17 EDT 2023


On 2023-10-22 7:35 PM, Dieter Maurer via Python-list wrote:
> 
> The web server in Python's runtime library is fairly simple,
> focusing only on the HTTP requirements.
> 
> You might want additional things for an HTTP server
> exposed on the internet which should potentially handle high trafic:
> e.g.
> 
>   * detection of and (partial) protection against denial of service attacks,
>   * load balancing,
>   * virtual hosting
>   * proxing
>   * URL rewriting
>   * high throughput, low latency
> 
> Depending on your requirements, other web servers might be preferable.

Dieter's response was very timely for me, as it provides some answers to 
a question that I was thinking of posting. My use-case is reasonably 
on-topic for this thread, so I won't start a new one, if that is ok.

I am writing a business/accounting application. The server uses Python 
and asyncio, the client is written in Javascript. The project is inching 
towards a point where I may consider releasing it. My concern was 
whether my home-grown HTTP server was too simplistic for production, and 
if so, whether I should be looking into using one of the more 
established frameworks. After some brief investigation into Dieter's 
list of additional requirements, here are my initial thoughts. Any 
comments will be welcome.

I skimmed through the documentation for flask, Django, and FastAPI. As 
far as I can tell, none of them address the points listed above 
directly. Instead, they position themselves as one layer in a stack of 
technologies, and rely on other layers to provide additional 
functionality. If I read this correctly, there is nothing to stop me 
doing the same.

Based on this, I am considering the following -

1. Replace my HTTP handler with Uvicorn. Functionality should be the 
same, but performance should be improved.

2. Instead of running as a stand-alone server, run my app as a 
reverse-proxy using Nginx. I tested this a few years ago using Apache, 
and it 'just worked', so I am fairly sure that it will work with Nginx 
as well. Nginx can then provide the additional functionality that Dieter 
has mentioned.

My main concern is that, if I do release my app, I want it to be taken 
seriously and not dismissed as 'Mickey Mouse'. Do you think the above 
changes would assist with that?

When I talk about releasing it, it is already available on Github here - 
https://github.com/FrankMillman/AccInABox.

You are welcome to look at it, but it needs a lot of tidying up before 
it will be ready for a wider audience.

Frank Millman



More information about the Python-list mailing list