[Django]-Manage.py syncdb is using another project's db in the virtualenv

2👍

Your problem is that your PYTHONPATH has proj1 listed before proj2. In that case, python will first look into proj1 for manage.py and execute that, and skip the manage.py in the current directory, even if it exists.

As a quick fix, add the current directory to the PYTHONPATH like this:

PYTHONPATH=/var/www/virtualenv-2.7/proj2
PYTHONPATH=/var/www/virtualenv-2.7/proj1:$PYTHONPATH
PYTHONPATH=.:$PYTHONPATH
export PYTHONPATH

This will first check for the script you’re looking for in the current directory.

Also, unless you have a specific goal in mind, you can lose the project specific paths and always start manage.py from the relevant directory.

Leave a comment