@nafmo uwsgi has a minimal example in their docs. Uwsgi is the thing that runs python, imports your script, and calls a function in it once per request. You only need to provide that function.
Have a look here: https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html