29👍
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',
}
}
12👍
in settings add:
DATABASES = {
'default': {
...
'TEST_CHARSET': "utf8",
'TEST_COLLATION': "utf8_general_ci",
}
}
- How to append pages of data using jQuery and Django pagination?
- No web processes running Django in heroku
9👍
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',
},
},
}
- Creating Partial Indexes with Django 1.7
- Get ContentType id in Django for generic relation
- Matplotlib svg as string and not a file
1👍
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…
- How to know what django version i use? is it 1.0, 1.1, or 1.2?
- Have a url that accepts all characters
- Django Postgres ArrayField vs One-to-Many relationship
- Clean Up HTML in Python
0👍
As others have pointed out, you need something like this to create the database
DATABASES = {
...
'TEST': {
'CHARSET': 'utf8mb4',
'COLLATION': 'utf8mb4_unicode_ci',
}
}
But you also will want to make sure that you have something like this as well, to make sure that your tests communicate with the db with the appropriate charset.
DATABASES = {
...
'OPTIONS': {
'charset': 'utf8mb4'
}
}
- How can I make SSE with Python (Django)?
- TimeField format in Django template
- How to download a filefield file in django view
- How to manage.py loaddata in Django
- What method attributes are used in Django?
-2👍
Take a look at the settings file example here: https://docs.djangoproject.com/en/dev/ref/databases/#connecting-to-the-database