我有一个django应用程序托管在googleappengine和googlecloudsql作为数据库。我遵循这个链接https://cloud.google.com/appengine/docs/python/cloud-sql/django来同步db模式并将其迁移到cloudsql。这对我很有效。但是当我今天尝试syncdb时,我得到了如下所示的错误。在
OperationalError: could not connect: https://www.googleapis.com/sql/v1/jdbc/openConnection?alt=proto returned "Not Found">
我的数据库设置是
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/<projectname>:<instancename>',
'NAME': '<db-name>',
'USER': 'root',
}
}
elif os.getenv('SETTINGS_MODE') == 'prod':
# Running in development, but want to access the Google Cloud SQL instance in production.
DATABASES = {
'default': {
'ENGINE': 'google.appengine.ext.django.backends.rdbms',
'INSTANCE': '<projectname>:<instancename>',
'NAME': 'db-name',
'USER': 'root',
}
}
我更改了我的数据库设置,并在googleapi控制台授权了我的本地ip地址。现在一切正常。
我的新数据库设置是
相关问题 更多 >
编程相关推荐