1👍
✅
I can see two clean solutions.
-
For this to work, your lib has to be Distutils compatible (have a
setup.py
) file. If it does, then you can simply install it withpip
with thee-
flag. Just do:pip install -e /full/path/to/foo.com/lib/
That will install the library in editable mode, meaning that the lib will not be installed to
site-packages
but will create an egg symlink there. That means that any changes you will make to the files within the lib will automatically go live within your environment. -
I don’t think this is as nearly as clean as the first suggestion by this will work. Just add the lib to the PATH in your Django’s
manage.py
:import os, sys root_path = os.path.abspath(os.path.join(__file__, '..', '..')) lib_path = os.path.join(root_path, 'lib') sys.path.insert(0, lib_path) # ...
Source:stackexchange.com