A wsgiref application function has to look as follows:
def application(environ, start_response):
start_response is just a function, while environ does not have any parameters set by the user (https://www.python.org/dev/peps/pep-3333/#environ-variables).
Given this, how could user-defined variables be used by the application without making them global?