4

I am creating a Django project based on PostGreSql on Windows OS.

I could successfully download Postgresql (32bits) and psycopg2. I work on a 32 bit Python2.7.9 , and my Postgresql - 9.3.7 32-bits.

  1. import psycopg2 throws NO error.
  2. I could find a psycopg2 folder in Python27\Lib\site-packages
  3. My settings.py contains the following:

    DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'testdb' , 'USER': 'postgres', 'PASSWORD': 'paggu', 'HOST': 'localhost', 'PORT': '5432', } }

But I still get the below error when I try to execute the command- python manage.py runserver or python manage.py syncdb

raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: DLL
load failed: The specified module could not be found.

I am not sure if I missed on anything.

I looked up on the other Stack Overflow posts regarding this problem but didn't seem to find any solution.

2
  • Are you using a virtualenv? Are you sure the env where the package is installed is the same as the project env? Commented Jun 1, 2015 at 16:31
  • No I am not using a virtualenv. Commented Jun 1, 2015 at 17:54

1 Answer 1

1

You may need to actually install psycopg2. To find out run the following in a Windows command prompt:

C:\path\to\project\> python

Then:

>>> help("modules")

If psycopg2 is not in the list, do the following:

Download: psycopg2-2.6.2.win32-py2.7-pg9.5.3-release.exe from HERE, then run the following in a Windows command prompt:

C:\path\to\project> easy_install /path/to/psycopg2-2.6.2.win32-py2.7-pg9.5.3-release.exe

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.