为了通过在新安装的django中继(1.4c1)上运行的单元测试,需要在settings.py中添加一个'dummy'other
数据库,像这样: -django 1.4c1单元测试寻找'其他'数据库
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': 'myuser', # Not used with sqlite3.
'PASSWORD': 'mypassword', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
},
# dummy sqlite3 database created to pass django's builtin unit tests
'other': {
'ENGINE': 'django.db.backends.sqlite3'
}
}
为什么会这样,什么是在Django/DB/utils.py的ConnectionHandler
类此 “ensure_defaults” 功能的目的是什么?
只是好奇,了解Django的在更深的层次......
是的,这是一个错误。请参阅http://groups.google.com/group/django-developers/browse_thread/thread/e30a9dcc5685954c/5cff8b0e820c1958?show_docid=5cff8b0e820c1958 – 2012-03-07 23:33:34