Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 976
Kim Stacks Avatar asked Nov 01 '25 12:11

Kim Stacks


1 Answers

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

like image 110
traintraveler Avatar answered Nov 03 '25 03:11

traintraveler