这里完全是新手,抱歉
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文件中的数据库部分如下所示:
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.所以我搞不懂它为什么说配置不当?
发布于 2013-08-19 20:52:56
您需要在数据库中指定settings.py字典
包含与Django一起使用的所有数据库设置的字典。它是一个嵌套字典,其内容将数据库别名映射到包含单个数据库选项的字典。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydatabase',
'USER': 'sarahr6',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}https://stackoverflow.com/questions/18322861
复制相似问题