[英]How to force to use new database when run python manage.py test in Django?
When I type 当我打字
python manage.py test
Sometimes I get asked if I want to delete the test database. 有时会询问我是否要删除测试数据库。
Type 'yes' if you would like to try deleting the test database 'test_replicate_live', or 'no' to cancel: yes
WHen I want to keep the test database, I know the command is : 我想保留测试数据库,我知道命令是:
python manage.py test --keepdb
I would like to know if there's a way to force the deletion of test database without waiting for the question to appear. 我想知道是否有一种方法可以强制删除测试数据库,而无需等待问题出现。
Sometimes I just know ahead of time, I want to delete the test database. 有时我只是提前知道,我想删除测试数据库。
Is tehre a 是吗
python manage.py test --nokeepdb
You could try 你可以试试
python manage.py test --noinput
Which would suppress the prompt and default to destroying the test database. 这将抑制提示,并且默认情况下会破坏测试数据库。
It's documented here, https://docs.djangoproject.com/en/2.2/topics/testing/overview/#the-test-database 它记录在这里, https://docs.djangoproject.com/en/2.2/topics/testing/overview/#the-test-database
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.