Multiple Databases
Settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'emoji_utf8',
'USER': 'root',
'PASSWORD': '',
},
'utf8mb4': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'emoji_utf8mb4',
'USER': 'root',
'PASSWORD': '',
'OPTIONS': {
'charset': 'utf8mb4',
},
}
}
Syncdb
python manage.py syncdb # default
python manage.py syncdb --database='utf8mb4' # set to syncdb utf8mb4
South
python manage.py migrate --database=utf8mb4
Using
models.objects.using('utf8mb4').filter()