I can't make it to post emojis to the database when I use my-app.appspot.com but when I run it locally python manage.py runserver
with the same libraries on GAE everything works perfectly and I can post and retrieve emojis .
当我使用my-app.appspot.com时,我无法将emojis发布到数据库中,但当我在本地运行它时,我可以使用python管理。在GAE上拥有相同库的py runserverall工作得很好,我可以发布和检索表情符号。
here is my settings .py
这是我的设置。py。
import os
if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine'):
# Running on production App Engine, so use a Google Cloud SQL database.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '/cloudsql/my-app:us-central1:my-app-mysql',
'NAME': '********',
'USER': 'root',
'PASSWORD': '*********',
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '*******',
'USER': 'root',
'PASSWORD': '*********',
'HOST': '**********',
'PORT': '3306',
'OPTIONS': {
'charset': 'utf8mb4',
}
}
}
here is the charset when using cloud shell
这是使用云shell时的字符集
mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| collation_connection | utf8_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+--------------------------+--------------------+
10 rows in set (0.15 sec)
and here is the charset when I connect using the IP of the database from another client
这是我使用数据库的IP从另一个客户端连接时的字符集
Variable_name Value
character_set_client utf8
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_unicode_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
I'm I missing something ?!!
我漏掉了什么?!
how do I make work?
我如何工作?
thanks https://github.com/GoogleCloudPlatform/appengine-django-skeleton/issues/28
由于https://github.com/GoogleCloudPlatform/appengine-django-skeleton/issues/28
1 个解决方案
#1
0
waprin: @EssaAlshammri reproduced, filed internal bug with engineering team, will keep you updated.
waprin: @EssaAlshammri复制,向工程团队提交内部bug,将会更新。
from github issue
从github的问题
You can try base64 encoding going in and out of the database as a workaround.
您可以尝试使用base64编码作为解决方案进出数据库。
it works fine.
它将正常工作。
you can wait until they fix the issue
你可以等到他们解决问题
#1
0
waprin: @EssaAlshammri reproduced, filed internal bug with engineering team, will keep you updated.
waprin: @EssaAlshammri复制,向工程团队提交内部bug,将会更新。
from github issue
从github的问题
You can try base64 encoding going in and out of the database as a workaround.
您可以尝试使用base64编码作为解决方案进出数据库。
it works fine.
它将正常工作。
you can wait until they fix the issue
你可以等到他们解决问题