Django Pytests in docker container not using temp sqlite3 database

I'm running pytest on a django app that lives in a docker container. Pytest is being run in the docker container after it's built. Normally the django app references a mysql container running on the same host. I've been trying to use a sqlite3 db instead for testing, but I've been having trouble getting it to use this instead of the mysql container.

I've gotten it to work one way:

from .settings import *

# Override the DATABASES setting to use SQLite for tests
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':memory:',


testpaths = ["tests"]
addopts = [


I don't want to do it this way because of the wildcard import (also my ruff linter doesn't like).

I've tried to overwrite using, but it seems to get overwritten again by the DJANGO_SETTINGS_MODULE env variable, which is set in the container's env file.

How can I get my pytest to use sqlite3 without using this wildcard import on Or without using at all?


Back to Top