Reputation: 51
I have tried many options available however nothing is worked for me.
This is my environment
This is the method I used to make the connectivity
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'xxxx',
'USER': 'postgres',
'PASSWORD': 'admin',
'HOST': 'localhost'
}
}
Error that I'm receiving :
(dev-test) F:\Personal\xxxx\Learning\Django\projects\jangoproject\devtest>python manage.py startserver
Traceback (most recent call last):
File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in <module>
import psycopg2 as Database
File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\psycopg2\__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.
During handling of the above exception, another exception occurred:
Upvotes: 1
Views: 330
Reputation: 2543
Windows 10 with conda
environment manager (fresh install of Django
, wagtail
with PostgreSQL
), had the same error. Removed psycopg2
conda remove -n myenv psycopg2
it updated some packages, removed others (it also removed django, wagtail... on its own). Then installed psycopg2
back
conda install -n myenv psycopg2
Tested it, import worked
python
>>> import psycopg2
Installed django
, wagtail
back. python manage.py migrate
now populated PostgreSQL
. Maybe the reason was that psycopg2 was installed after django and wagtail, this reversed the installation order.
Upvotes: 0
Reputation: 11
You could try the command
pip install django psycopg2
'ENGINE' : 'django.db.backends.postgresql_psycopg2',
'PORT' : ' '
So the default port is selected
Upvotes: 1