I am using googleAppEngineLauncher to try mysql connection.
我正在使用googleAppEngineLauncher来尝试mysql连接。
It gives the log
它给出了日志
File "/Users/kakshilshah/Desktop/hope/skeduleBackend/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/kakshilshah/Desktop/hope/skeduleBackend/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql
I have done pip install MySQL-python
我已经完成了pip install MySQL-python
Even commands like python manage.py dbshell
works, and connects me to the cloudsql backend.
甚至像python manage.py dbshell这样的命令也可以工作,并将我连接到cloudsql后端。
I can access all the tables there.
我可以访问那里的所有表。
But, running it gives the same error.
但是,运行它会产生同样的错误。
I have mysql 5.6 installed.
我安装了mysql 5.6。
Adding the following to app.yaml
将以下内容添加到app.yaml
- name: MySQLdb
version: "latest"
also does not help, because I checked the libraries directory and there was no mysqldb.
也没有帮助,因为我检查了库目录,没有mysqldb。
My settings -
我的设置 -
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '173.194.xxx.xxx',
'NAME': 'my_database',
'USER': 'root',
'PASSWORD': 'xxxxxxxx',
}
}
Stuck here, please help.
被困在这里,请帮忙。
1 个解决方案
#1
You cannot have MySQL-python while uploading. Remove that and then upload.
上传时不能使用MySQL-python。删除它,然后上传。
Just the YAML file's
只是YAML文件
- name: MySQLdb
version: "latest"
Will do, if you add both, it causes a clash.
如果你同时添加两者,它会导致冲突。
It runs locally because it does not consider the YAML's sqldb connector.
它在本地运行,因为它不考虑YAML的sqldb连接器。
Hope this helps!
希望这可以帮助!