I am having some trouble with migrating Django using postgresql.
This is my first time with Django, and I am just following the tutorial.
As suggested on the
It's because you use Django in a python virtualenv and as stated on virtualenv web site :
It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).
That means that you need to install psycopg2 in your virtualenv and not globaly or make it access globaly installed libraries.
It must be because you are installing psycopg2 in your system level python installation not in your virtualenv.
sudo apt-get install python-psycopg2
will install it in your system level python installation.
You can install it in your virtualenv by
pip install psycopg2
after activating your virtualenv or you can create your virtualenv with --system-site-packages
flag so that your virtualenv will have packages in your system level python already available.
virtualenv --system-site-packages test
where test
is your virtualenv.
Psycopg is the most popular PostgreSQL database adapter for the Python programming language. I was also facing a similar problem when I tried to run the migration with Postgresql database. The below step worked for me fine.
Activate your Virtual Environment and run the following command
pip install psycopg2-binary
Now try running python manage.py migrate