【发布时间】:2017-11-24 04:00:41
【问题描述】:
当我运行python manage.py test 时,django 每次都会问一个奇怪的问题:
$ python manage.py test
Creating test database for alias 'default'...
Got an error creating the test database: (1044, "Access denied for user 'nyble'@'localhost' to database 'test_nybledb'")
Type 'yes' if you would like to try deleting the test database 'test_nybledb', or 'no' to cancel:
我希望它只是删除并重新制作一个基本的 sqlite3 数据库,我不希望这种行为。
无论我说是或否,它都会退出测试:
Destroying old test database for alias 'default'...
Got an error recreating the test database: (1044, "Access denied for user 'nyble'@'localhost' to database 'test_nybledb'")
在我的设置中
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'nybledb',
'USER': 'nyble',
'PASSWORD': 'password',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
}
}
如何在运行测试期间停止它并使其使用正常的 sqlite3 db?
【问题讨论】:
标签: python django django-unittest