Google App Engine에 django-backend가있는 웹 사이트를 배포하고 있습니다. 나는 그들 tutorial을 따라 갔다. MySQL을 사용하여 로컬 서버에서 웹 사이트를 실행했으며 완벽하게 실행됩니다. 구글 앱 엔진에 배포 그것은 나에게 다음과 같은 오류를 제공하는 경우 는 :Google App Engine Django : 배포 후 Google Cloud SQL에서 테이블을 만들 수 없습니다.
if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine'):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'database_name',
'USER': 'user_name',
'PASSWORD': 'password',
'HOST': '/cloudsql/copied perfectly from google cloud sql instance',
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1',
'PORT': '3306',
'NAME': 'database_name',
'USER': 'username',
'PASSWORD': 'password',
}
}
: 여기
# [START django_app]
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /static
static_dir: static/
- url: .*
script: wt.wsgi.application
# Only pure Python libraries can be vendored
# Python libraries that use C extensions can
# only be included if they are part of the App Engine SDK
# Using Third Party Libraries: https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27
libraries:
- name: MySQLdb
version: 1.2.5
- name: django
version: "1.11"
env_variables:
CLOUDSQL_CONNECTION_NAME: 'copied perfectly from google cloud sql instance'
CLOUDSQL_USER: username
CLOUDSQL_PASSWORD: password
# [END django_app]
# Google App Engine limits application deployments to 10,000 uploaded files per
# version. The skip_files section allows us to skip virtual environment files
# to meet this requirement. The first 5 are the default regular expressions to
# skip, while the last one is for all env/ files.
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^env/.*$
내 settings.py입니다 : 여기
ProgrammingError "Table 'clouddatabasename'.'appname'_'modelname' doesn't exist"
내 애플리케이션 제목입니다 친절하게 도와주세요. 내 모델/테이블을 Google App Engine에서 사용할 수없는 이유를 모르겠습니다. 미리 감사드립니다!
'cloud_sql_proxy.exe -instances = "[YOUR_INSTANCE_CONNECTION_NAME]"= tcp : 3306' "이 단계는 로컬 컴퓨터와 로컬 컴퓨터의 Cloud SQL 인스턴스에 대한 연결을 설정합니다 응용 프로그램을 로컬에서 테스트 할 때마다 Cloud SQL Proxy가 실행되도록하십시오. " 응용 프로그램을 로컬에서 테스트해야 할 때만 Cloud SQL Proxy를 사용해야한다고 말합니다. – Maverick7
감사합니다! 당신이 옳았! Google은 설명서를 명확하게 작성해야합니다. – Maverick7