Kim Stacks
Kim Stacks

Reputation: 10812

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

Upvotes: 4

Views: 1554

Answers (1)

traintraveler
traintraveler

Reputation: 381

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

Upvotes: 7

Related Questions