所以在我的settings.py我指定的两个数据库连接(见下文)。
但是,当我运行测试,我只希望Django的创建“默认”数据库。
有没有办法做到这一点? 我尝试添加了TEST_CREATE:假的选择,但我想这只是对于Oracle出于某种原因?
我的settings.py片段:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'App1', # Or path to database file if using sqlite3.
'USER': 'webaccess', # Not used with sqlite3.
'PASSWORD': '***', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
},
'default_root': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'App1', # Or path to database file if using sqlite3.
'USER': 'django', # Not used with sqlite3.
'PASSWORD': '****', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'TEST_CREATE': False #Don't create when testing
}
}