When running pgAdmin as a WSGI application, we will not be able to find

the '__main__' module under 'sys.modules'.
This commit is contained in:
Ashesh Vashi 2017-04-03 18:43:38 +05:30
parent 74655e60a0
commit b756407c3c

View File

@ -113,7 +113,8 @@ class ServerType(object):
))
)
bin_path = self.utility_path.get()
if "$DIR" in bin_path:
# AS WSGI application, we will not find the '__main__' module.
if "__main__" in sys.modules:
bin_path = bin_path.replace("$DIR", os.path.dirname(sys.modules['__main__'].__file__))
return os.path.abspath(os.path.join(