mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
As per Murtuza, we will have the '__module__', when running as a WSGI
application, but - it will not have the '__file__' attribute.
This commit is contained in:
parent
b756407c3c
commit
02a3919b06
@ -113,9 +113,17 @@ class ServerType(object):
|
|||||||
))
|
))
|
||||||
)
|
)
|
||||||
bin_path = self.utility_path.get()
|
bin_path = self.utility_path.get()
|
||||||
# AS WSGI application, we will not find the '__main__' module.
|
if "$DIR" in bin_path:
|
||||||
if "__main__" in sys.modules:
|
# When running as an WSGI application, we will not find the
|
||||||
bin_path = bin_path.replace("$DIR", os.path.dirname(sys.modules['__main__'].__file__))
|
# '__file__' attribute for the '__main__' module.
|
||||||
|
main_module_file = getattr(
|
||||||
|
sys.modules['__main__'], '__file__', None
|
||||||
|
)
|
||||||
|
|
||||||
|
if main_module_file is None:
|
||||||
|
bin_path = bin_path.replace(
|
||||||
|
"$DIR", os.path.dirname(main_module_file)
|
||||||
|
)
|
||||||
|
|
||||||
return os.path.abspath(os.path.join(
|
return os.path.abspath(os.path.join(
|
||||||
bin_path,
|
bin_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user