Fine. Here is an application that only prints its name:
class Tester(object):
def __call__(self, environ, startResponse):
startResponse("200 OK", [("Content-Type", "text/plain")])
ApplicationName=environ['mod_wsgi.process_group']
return ["Application name: {}".format(ApplicationName)]
application=Tester()
Inside __call__, environ works as expected. But now I want to save
work by moving ApplicationName to __init__
class Tester(object):
def __init__(self):
self.environ=environ
def __call__(self, environ, startResponse):
startResponse("200 OK", [("Content-Type", "text/plain")])
ApplicationName=self.environ['mod_wsgi.process_group']
return ["Application name: {}".format(ApplicationName)]
application=Tester()
I get:
NameError: global name 'environ' is not defined
How do I get environ inside __init__?
-- Gnarlie
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.