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 Django website, I have created a virtualenv to run the Django project.
Next, I created a postgresql database with these settings:
In settings.py I have set these values for the database:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_tutorial',
'USER': 'johan',
'PASSWORD': '1234',
}
}
When installing psycopg2 with apt-get I get this message:
(venv)johan@johan-pc:~/sdp/django_tutorial/venv/django_tutorial$ sudo apt-get install python-psycopg2
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-psycopg2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
As far as I can tell this would mean that psycopg2 is installed.
When running
$python manage.py migrate
I get the following error message:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
If needed for the answer I could provide the entire stack trace.
Could someone explain what I could do to solve this? I have also looked on Google for a solution with no luck.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…