About PYTHONPATH

PYTHONPATH defines where your Python modules are located. You can add some extra paths to PYTHONPATH in the Django project settings by modifying the sys.path list:

1
2
import sys
sys.path = ["", EXTRA_PATH] + [p for p in sys.path if p]

The first item of the list should be an empty string, so that relative paths are checked first.

Tips and Tricks Programming Dev Ops Django 3.2 Django 2.2 Django 1.11 Django 1.8 Python 3