I am using utf-8 general case insensitive for for mysql database, but django creates a test db with latin collation 
I have set this:
TEST_CHARSET="utf8_general_ci"
TEST_COLLATION="utf8_general_ci"
In the settings file, but to no avail.
What else should i do?
TEST_CHARSET and TEST_COLLATION are renamed to CHARSET and COLLATION and moved to TEST dictionary in Django 1.8:
DATABASES = {
    ...
    'TEST': {
        'CHARSET': 'utf8',
        'COLLATION': 'utf8_general_ci',
    }
}
                        in settings add:
DATABASES = {
    'default': {
        ...
        'TEST_CHARSET': "utf8",
        'TEST_COLLATION': "utf8_general_ci",
    }
}
                        Please see here: https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-DATABASE-TEST
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': <db_name>,
        'USER': <user>,
        'PASSWORD': <password>,
        'HOST': <host>,
        'PORT': <port>,
        'TEST': {
            'NAME': <test_db_name>,
            'CHARSET': 'utf8',
            'COLLATION': 'utf8_general_ci',
        },
    },
}
                        I had the same problem and spent hours of figuring it out until noticed that
TEST_CHARSET
TEST_COLLATION
should be a part of the DATABASES, not settings.py. It's very easy to mix them up...
https://docs.djangoproject.com/en/dev/ref/settings/#testing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With