Search notes:

Python standard library: wsgiref

wsgiref is the reference implementation for WSGI

simple_server

Among others, wsgiref.simple_server exports WSGIServer and WSGIRequestHandler which allow to test a WSGI appliction.
In the following example, the WSGI application is implemented with the callable (function) app. The application simply writes the Hello World! followed by a line that reveals the value of the environment variable PATH_INFO:
#!/usr/bin/env python3

from wsgiref.simple_server import WSGIServer, WSGIRequestHandler

def app(environ, start_response):

    start_response(
       '200 OK',
       [('Content-Type', 'text/plain; charset=utf-8')]
    )

  #
  #  The application callable returns an iterable yielding zero or more bytestrings:
  #
    return [
       'Hello world!\n'                .encode('utf-8'),
      f'Serving {environ["PATH_INFO"]}'.encode('utf-8')
    ]


host = ''   # Localhost?
port = 1234

wsgiServer = WSGIServer( (host,port) , WSGIRequestHandler )
wsgiServer.set_app(app)
wsgiServer.serve_forever()

See also

standard library

Links

wsgiref is the reference implementation for WSGI.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745043127, '3.147.63.58', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/standard-library/wsgiref/index(75): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78