Setup Postgresql Database in Django

Posted on 2012-04-06 18:38  仆本浪人  阅读(577)  评论(0编辑  收藏  举报

出现错误:django.core.exceptions.ImproperlyConfigured: 'postgresql_psycopg2' isn't an available database backend.

Try using django.db.backends.postgresql_psycopg2 instead.

Error was: No module named postgresql_psycopg2.base

 

改了下setting.py

 

DATABASES = {

    'default': {

        'ENGINE': 'django.db.backends.postgresql_psycopg2',   # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.

        'NAME': 'mydb',                      # Or path to database file if using sqlite3.

        'USER': 'postgres',                      # Not used with sqlite3.

        'PASSWORD': 'naonao',                  # Not used with sqlite3.

        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.

        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.

    }

}