我目前正在玩 django 并想用作我的数据库 postgresql:
这些是我在设置文件中的配置:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'django', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': 'postgres', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
}
}
我还尝试使用 postgresql_psycopg2 并安装了 psycopg2(http://www.stickpeople.com/projects/python/win-psycopg/)。
任何想法配置有什么问题?
更新:
错误:
> File
> "C:\Python27\lib\site-packages\django\core\management\__init__.py",
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python27\lib\site-packages\django\core\management\base.py", line
> 196, in run_from_argv
> self.execute(*args, **options.__dict__) File "C:\Python27\lib\site-packages\django\core\management\base.py", line
> 232, in execute
> output = self.handle(*args, **options) File "C:\Python27\lib\site-packages\django\core\management\base.py", line
> 371, in handle
> return self.handle_noargs(**options) File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py",
> line 57, in handle_noargs
> cursor = connection.cursor() File "C:\Python27\lib\site-packages\django\db\backends\dummy\base.py", line
> 15, in complain
> raise ImproperlyConfigured("settings.DATABASES is improperly configured. " django.core.exceptions.ImproperlyConfigured:
> settings.DATABASES is improperly configured. Please supply the ENGINE
> value. Check settings documentation for more details.