This is a simple
WSGI http server
project. I have used Flask with him.
It is made for educational purposes so that everyone can get
acquainted with how the WSGI protocol works in general and how
it relates to the work of Python frameworks.
Study the source code of the wsgi.py file,
a small documentation has been written for each method,
it will help you figure out how it works.
At the end you will also find useful links on this topic.
-
Clone this repository
git clone https://github.com/AlexanderSeryakov/WSGi-http-server.git
-
Move to project dir
cd WSGi-http-server
-
Install dependencies
poetry install
-
Now you can start WSGI http server
-
Move to direcory with source code
cd wsgi_http_server
-
Start WSGI http server
python wsgi.py flask_app:app
-
If all done, you will see a message in the console
-
Open new tab in your browser and paste this url
127.0.0.1:9000
-
Well, now you can use this WSGI http server for your application
This project uses a Flask application as a web application.
You can add new endpoints and change existing ones.
To do this, go to the flask_app.py file.
You can also use another framework to connect it to this WSGi server see the framework documentation.
WSGI specification - PEP 333 – Python Web Server Gateway Interface v1.0
Socket programming - Socket programming guide for beginners.
HTTP protocol - An overview of HTTP