Skip to content

Commit

Permalink
Handle emoji for mysql
Browse files Browse the repository at this point in the history
Define charset when mysql
  • Loading branch information
WongSaang committed Mar 23, 2023
1 parent 0b19ef7 commit 95978e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chatgpt_ui_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@

WSGI_APPLICATION = 'chatgpt_ui_server.wsgi.application'

db_config = dj_database_url.config('DB_URL', 'sqlite:///db.sqlite3')
if db_config.get('ENGINE') == 'django.db.backends.mysql':
db_config['OPTIONS'] = {'charset': 'utf8mb4'}

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': dj_database_url.config('DB_URL', 'sqlite:///db.sqlite3')
'default': db_config
}


Expand Down

0 comments on commit 95978e2

Please sign in to comment.