No, for one '--relocatable' does not update 'virtualenv/bin/activate' script. Yes you can fix that by re-running virtual env setup as zeekay suggested, however that stills fails to import any 'pip -e git ...' installs which are placed in 'virtualenv/src' so you will have to re-run those pip installs manually.
As I have gained experience as a developer I now avoid additional layers of dependency and abstraction which just have a tendency to be points of failure.
So now I don't install with pip editable (-e) and if needed manually clone repositories into 'project/src/' as opposed to 'project/virtualenv/src' and have the below auto_prep_pythonpath.py
script loaded prior to launching my project (I reference it in my django.wsgi
script).
As a side note I append 'tailored' to any packages placed in 'project/src' that are modified/hacked so this way I don't have to worry about backward compatibility and I track all source under code control as online repositories can and will brake on you.
Hope this helps.
"""
Prepares python path to include additional project/src/<APP> in PYTHONPATH - This file gets automatically loaded by projects __init__.py
This script lives in 'project/src/django-project/auto_prep_pythonpath.py', modify
'SOURCE_ROOT' if you place it somewhere else.
"""
import logging
import os
import sys
SOURCE_ROOT = os.path.dirname(os.path.abspath(__file__)).replace('\\','/') # the replacements are when on windows
SOURCE_ROOT = os.path.join(SOURCE_ROOT, '../').replace('\\','/')
SOURCE_ROOT = os.path.normpath(SOURCE_ROOT)
logger = logging.getLogger(__name__)
logger.info("Adding packages in 'src/*' required by project to PYTHONPATH.")
dirlist_arr = os.listdir(SOURCE_ROOT)
while dirlist_arr:
item_path = os.path.join(SOURCE_ROOT, dirlist_arr.pop()).replace('\\','/') # replace dashes is for win based file system
if os.path.isdir(item_path):
if not item_path in sys.path:
sys.path.insert(0, item_path) # we use insert to take precedence over any global paths - minimizes import conflict surprises
logger.debug("Path '%s' added." % item_path)