'How to test django using test sqlite3 database instead default mysql database?
My databases in settings.py
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER': 'user',
'PASSWORD': 'password',
'HOST': 'mydb.com',
'TEST': { # it's not works
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
But TEST section not work.
I use this code and it works but i don't like it. Maybe there are other way in databases section describe test database?
if 'test' in sys.argv:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
