Ich bin eine Website mit Django-Backend auf Google App Engine bereitstellen. Ich folgte ihrem tutorial. Ich habe die Website auf meinem lokalen Server mit MySQL ausgeführt und es läuft perfekt. Wenn bereitstellen es auf Google App Engine es mir die folgende Störung gibt:Google App Engine, Django: Tabellen werden nicht in Google Cloud SQL nach der Bereitstellung erstellt
ProgrammingError "Table 'clouddatabasename'.'appname'_'modelname' doesn't exist"
Hier ist meine app.yaml:
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/.*$
Hier mein settings.py ist Bitte hilf mir. Ich weiß nicht, warum meine Modelle/Tabellen nicht in der Google App Engine verfügbar sind. Danke im Voraus!
' cloud_sql_proxy.exe -instances = "[YOUR_INSTANCE_CONNECTION_NAME]" = tcp: 3306' "Dieser Schritt baut eine Verbindung von Ihrem lokalen Computer zu Ihrer Cloud SQL-Instanz für local auf Testen Sie den Cloud SQL-Proxy während der gesamten Zeit, in der Sie Ihre Anwendung lokal testen. " Es besagt, dass Sie den Cloud SQL-Proxy nur verwenden müssen, wenn Sie Ihre Anwendung lokal testen müssen – Maverick7
Vielen Dank! Du hattest Recht! Google muss die Dokumentation klarer machen ... – Maverick7