2👍
Note:
I undeleted this answer for future reference. The solutions below allow importing two different modults from files with the same name, but don’t allow running two Django projects in one interpreter (see this comment and this comment).
Solution #1
You could try turning projects into python packages.
1. Add an empty __init__.py to /path/project1/ and /path/project2/
2.
sys.path.append('/path/')
sys.path.append('/path/project1/')
sys.path.append('/path/project2/')
import project1.settings
import project2.settings
setup_environ(project1.settings)
setup_environ(project2.settings)
Solution #2
1) Make a directory in your /path/ containing symbolic links to the setting files
cd /path/
mkdir setting_links
cd setting_links
ln ../project1/settings.py settings_1.py
ln ../project2/settings.py settings_2.py
2) Put both projects and the directory onto the sys.path
sys.path.append('/path/setting_links/')
sys.path.append('/path/project1/')
sys.path.append('/path/project2/')
import settings_1
import settings_2
setup_environ(settings_1)
setup_environ(settings_2)
Source:stackexchange.com