[Fixed]-How to avoid creating test database for testing in django?


python manage.py test -k

In Django 1.8, you can use -k command.

New in Django 1.8: You can prevent the test databases from being
destroyed by adding the –keepdb flag to the test command. This will
preserve the test database between runs. If the database does not
exist, it will first be created. Any migrations will also be applied
in order to keep it up to date.

You can read this for more details:


Well, it’s just a comment, not an answer yet – so I’ll repeat the comment of Rahul Gupta:

Just subclass from SimpleTestCase instead of TestCase, see Django Testing Tools Documentation.


Leave a comment