I have installed postgres and Psycopg2 using apt-get on my linux.
I want to use postgres for one of my django project.
I have created virtualenv but i am not able to work with psycopg2 when i add it in db settings.
Here is setting.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'secondnginxapp',
'USER': 'myprojectuser',
'PASSWORD': 'postgres',
'HOST': '127.0.0.1',
'PORT': '',
}
}
I run the server and got the error Error loading psycopg2 module: No module named 'psycopg2'
I check installed psycopg2 with following command.
python -c "import psycopg2; print(psycopg2.__version__)"
Output: 2.4.5 (dt dec mx pq3 ext)
How to use psycopg2 with virtualenv? need help.
(I am learning python and django)
I tried to install in virtualenv as well.
pip install psycopg2 then error is Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
Then i tried pip install libpq-dev now error is No matching distribution found for libpq-dev
python manage.py runserver