1
總新手在這裏,遺憾settings.DATABASES配置不當
- 的Mac OSX 10.8的Python 2.7(與自制安裝)
- 的PostgreSQL 9.4(與自制安裝)
- psycopg2 2.5(安裝了MacPorts的)
- Django的1.0.4(經由
python setup.py install
安裝)
我使用this tutorial,並開始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文件的數據庫部分看起來是這樣的:
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.
所以我不明白爲什麼它說它配置不當?