March 2020
Intermediate to advanced
608 pages
17h 17m
English
A module is meant to be under the Python path if you can run Python and import that module. One of the ways to put a module under the Python path is to modify the sys.path variable before importing a module that is in an unusual location. The value of sys.path, as specified by the settings file, is a list of directories starting with an empty string for the current directory, followed by the directories in the project, and finally the globally shared directories of the Python installation. You can see the value of sys.path in the Python shell, as follows:
(env)$ python manage.py shell>>> import sys>>> sys.path
When trying to import a module, Python searches for the module in this list and returns the first result that is found. ...