Reputation: 6314
I am trying to get Django and PostgreSQL to work.
So far I am getting the following error when I run syncdb
.
....
django.core.exceptions.ImproperlyConfigured:
Error loading psycopg2 module: No module named psycopg2
The following is my settings.py
.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mydb', # Or path to database file if using sqlite3.
'USER': 'username', # Not used with sqlite3.
'PASSWORD': 'pwd123', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
}
}
I think I have installed psycopg2 correctly, but I am not sure (through MacPorts).
Is there a way whether I can check whether psycopg2 is installed?
This link contains the install log of psycopg2
UPDATE
I got it working with the method below, but how do I check whether psycopg2 was actually installed before? and if so how to remove it completely?
Upvotes: 1
Views: 4533
Reputation: 181450
If you are using MAC, make sure psycopg2
is installed and accesible to your main python interpreter.
This is how I'd install it on a mac:
$ sudo easy_install django
$ sudo easy_install psycopg2
Then test it:
$ python
>>> import django
>>> import psycopg2
You should not get any errors.
Also, if you are using an Eclipse/PYDEV, make sure you reconfigure your interpreter after installing django and psycopg2 libraries.
Upvotes: 5