Current directory in Python module search path not working for django-admin
-dell:~/Documents/DjangoTutorial$ tail -2 ~/.bashrc export PYTHONPATH=$HOME/Documents/DjangoTutorial/mysite export DJANGO_SETTINGS_MODULE=mysite.settings -dell:~/Documents/DjangoTutorial$ . ~/.bashrc
and "django-admin runserver" is working from anywhere, with sys.path in Python3.7 showing:
>>> sys.path ['', '/home/Documents/DjangoTutorial/mysite', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages']
Then I read article1 and article2 which imply that "sys.path" consists of : current dir.(denoted as ''), PYTHONPATH, standard and installed libraries. So I invoked django-admin strictly from the PYTHONPATH directory but commented out "#export PYTHONPATH" in ./bashrc and got an error as shown below:
-dell:~/Documents/DjangoTutorial/mysite$ django-admin runserver Traceback (most recent call last): ... **ModuleNotFoundError**: No module named 'mysite'
I then checked sys.path and '' was there:
-dell:~/Documents/DjangoTutorial/mysite$ python3 >>> sys.path ['', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages']
My question is that if '' is equal to PYTHONPATH in this case and why cannot it find the settings module?