总新手在这里,对不起
- Mac OSX 10.8 Python 2.7(随自制软件安装)
- PostgreSQL 9.4(随自制软件安装)
- psycopg2 2.5(与 macports 一起安装)
- Django 1.0.4(通过安装
python setup.py install
)
我正在使用本教程,开始后python manage.py shell
我跑了
>>> from django.db import connection
>>> cursor = connection.cursor()
并得到以下信息:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 15, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
我的 settings.py 文件的 DATABASES 部分如下所示:
DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2' #postgresql_psycopg2
DATABASE_NAME = 'mydatabase' #mydatabase
DATABASE_USER = 'sarahr6' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
所以我不明白为什么它说它配置不正确?