For Python web apps, ASGI is generally used. It's got a lot of similarities to CGI, and many improvements.
If you just want to run a simple script, you can write your script to use the ASGI interface directly, and just run it under a server like gunicorn/uvicorn, or an ASGI module for Apache or whatever other webserver you like.
If you want to do something fancier, there are several good frameworks for #ASGI use.
While I didn't know about ASGI before today, it looks nice, might bring it up at work. But I really just want to do is parse a QUERY_STRING, look for a few files & "<img" display them.
Stupid home projects are getting harder.
What you're looking for, probably, is Flask and the underlying libraries it uses. It's a web "microframework". You can write a script to do what you describe with a bare minimum of code and pain.
You can implement a surprising amount of functionality in a screenful of code with Flask.
Oh, and if ASGI is overkill for your application - don't need high-performance async stuff - WSGI, which it is based on, is even easier to write scripts for.
To my surprise, I received the following warning in my Apach system: DeprecationWarning: ‘cgi’ is deprecated and slated for removal in Python 3.13. I need the function cgi.FieldStorage() for extracting parameters from each Internet request from my web system such as ‘?aaa=111&bbbb=222&ccc=333’. What is the best alternative function for cgi?
The CGI module has issues, it's allowed to go away. But there should still be a stupid CGI module. For simple scripts. Parse the input, run code for the output, provide a http header for the output. I'm already jumping through SELinux hoop to get that to work. Just the CGI interface, no extra apache modules.
Or is there an option & I'm missing it?
I don't want to create, even an sqlite, database for everything.