Hi, I have a question about Glenn's post from July 20. I need to change my working directory and want to understand if any hidden changes would result. If my sys.path in my wsgi.py file and my working directory differ, do both end up in my PYTHONPATH?
My working directory is
/home/username/app_root/modules_folder
And my wsgi.py file contains
path = os.path.expanduser('/home/username/app_root')
if path not in sys.path:
sys.path.append(path)
My PYTHONPATH should be app_root/modules_folder
, but I incorrectly set it to app_root
in my wsgi.py file. And my working directory should be app_root
, but I set it to app_root/modules_folder
. However, I'm having no issue importing my modules that live in modules_folder, and I think that's because my working directory gets added to my PYTHONPATH.
Basically, I incorrectly switched my working directory and sys.path but my error somehow didn't result in failure, and trying to understand why.