Answer the question
In order to leave comments, you need to log in
How to run django test on sqlite?
In general, the system uses mysql, but for tests I would like to use sqlite.
In settings.py DATABASES default is set to mysql.
For tests, you need to somehow override default or can you create something else and indicate to tests that you need to use a different database?
Answer the question
In order to leave comments, you need to log in
Make a separate config for tests:
# project.settings_test
from .settings import *
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
And run tests with an explicit test config:./manage.py test --settings=project.settings_test --failfast
As you will later understand, the database is not the only thing that it is desirable to redefine for tests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question