2
Google App Engine 및 Google Cloud SQL에 데이터베이스로 호스팅되는 장고 앱이 있습니다. 나는이 링크 https://cloud.google.com/appengine/docs/python/cloud-sql/django을 따라 db schema를 cloudsql로 동기화 및 마이그레이션합니다. 이것은 나를 위해 잘 일했다. 하지만 오늘 syncdb를 시도했을 때 아래와 같은 오류가 나타납니다.django syncdb를 수행하는 동안 Google 클라우드 SQL 오류
OperationalError: could not connect: https://www.googleapis.com/sql/v1/jdbc/openConnection?alt=proto returned "Not Found">
내 데이터베이스 설정은 내 DB 설정을 변경하고 구글 API를 콘솔에서 내 로컬 IP 주소를 공인
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',
}
}
나는이 문제를 해결했습니다. – taelimoh