Skip to content

Commit

Permalink
fix ascii codec error, by using utf8 (langgenius#1608)
Browse files Browse the repository at this point in the history
Co-authored-by: crazywoola <[email protected]>
  • Loading branch information
yunyu-Mr and crazywoola authored Dec 8, 2023
1 parent 8b01005 commit e5c7a81
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'DB_HOST': 'localhost',
'DB_PORT': '5432',
'DB_DATABASE': 'dify',
'DB_CHARSET': 'utf8mb4',
'REDIS_HOST': 'localhost',
'REDIS_PORT': '6379',
'REDIS_DB': '0',
Expand Down Expand Up @@ -148,10 +149,10 @@ def __init__(self):
# ------------------------
db_credentials = {
key: get_env(key) for key in
['DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_PORT', 'DB_DATABASE']
['DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_CHARSET'']
}

self.SQLALCHEMY_DATABASE_URI = f"postgresql://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}"
self.SQLALCHEMY_DATABASE_URI = f"postgresql://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}?client_encoding={db_credentials['DB_CHARSET']}"
self.SQLALCHEMY_ENGINE_OPTIONS = {
'pool_size': int(get_env('SQLALCHEMY_POOL_SIZE')),
'pool_recycle': int(get_env('SQLALCHEMY_POOL_RECYCLE'))
Expand Down

0 comments on commit e5c7a81

Please sign in to comment.