For Django you should not need to set SQLALCHEMY_DATABASE_URI in app.yaml. This is just used in the Python Google Cloud SQL on Flask code sampl <https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/flexible/cloudsql>e to set that environment variable that the sample code uses when deployed. The app.yaml in the Django code sample <https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/flexible/django_cloudsql/app.yaml> does not set this environment variable.
I'd recommend following the Django on Flex <https://cloud.google.com/python/django/flexible-environment> tutorial end-to-end and see what happens. You'll be able to see if the CloudSQL connection works properly by going to the admin part of the deployed web app at [YOUR_PROJECT_ID].appspot.com/admin, logging in with the superuser you define, and adding a question or two. Good luck, and let us me know if you have any more issues! Best, Ryan Matsumoto Developer Programs Engineer, Google Cloud (Python) On Wednesday, April 12, 2017 at 11:33:53 AM UTC-7, Tas Sóti wrote: > > Hello George, > > Thank you for the quick response. I was following the Running Django in > the App Engine Flexible Environment > <https://cloud.google.com/python/django/flexible-environment> tutorial > and it does not say anything about the SQLALCHEMY_DATABASE_URI environment > variable. Is it not meant for SQLAlchemy only? I am using Django's ORM. I > actually have another instance running with the same app.yaml as described > above and it is working. The difference is that that project (including > both the App Engine and SQL instance) is in the us-central region and I > deployed it a couple of months ago, when the App Engine Flexible was still > in beta. > > So is now the SQLALCHEMY_DATABASE_URI variable meant for using with the > Django ORM, too, and the old beta_settings is deprecated? > I'll give it a try, it is just not very logical (at least for me), why the > variable name includes "SQLAlchemy" if it is meant for any kind of > python<->sql connection. > > Thank you in advance, > Tas > > On Wednesday, April 12, 2017 at 8:08:24 PM UTC+2, George (Cloud Platform > Support) wrote: >> >> Hello Tas, >> >> To allow your app to connect to your Cloud SQL instance when the app is >> deployed, add the user, password, database, and instance connection name >> variables from Cloud SQL to the related environment variables in the >> app.yaml file: >> >> env_variables: >> >> # Replace user, password, database, and instance connection name with >> the values obtained >> >> # when configuring your Cloud SQL instance. >> >> SQLALCHEMY_DATABASE_URI: >- >> >> >> >> mysql+pymysql://USER:PASSWORD@/DATABASE?unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME >> >> It may be worthwhile to check in detail this information and the other >> related steps in the “Using Cloud SQL for MySQL” document >> <https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql>. >> This solution, with relevant detail, is given in the “cloudsql databases >> with django on 'new' flexible google app engine” question >> <http://stackoverflow.com/questions/39034250/cloudsql-databases-with-django-on-new-flexible-google-app-engine> >> >> on Stackoverflow. >> >> The “Running Django in the App Engine Flexible Environment” documentation >> page <https://cloud.google.com/python/django/flexible-environment> might >> prove quite helpful for related details. >> >> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/72c666af-3dd2-4f1b-a99c-21cd4cc6dc9f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.