Hello Ryan and Zdenko,

Thank you very much for the quick replies!

After some more hours I figured out what the problem was. The *Cloud SQL 
API* was not enabled for my project. Although it is nicely stated in the 
tutorial <https://cloud.google.com/python/django/flexible-environment>'s 
*Before 
you begin* section to enable the APIs, since I have little experience with 
the Google Cloud Console, I overlooked the difference between the two:

<https://lh3.googleusercontent.com/-XrcBJkd55zQ/WPNF16Mf9WI/AAAAAAABQLw/JwaxcALtctcZOCv7WAZ6AD_Vpla2cU8CwCLcB/s1600/2017-04-16%2B12_21_44-Dashboard%2B-%2Bcm-platform-02.png>

Google Cloud SQL is enabled by default, so I thought, all was good. 
Additionally, in the tutorial it is stated that the API is called *Cloud 
SQL Administration*. (I know that you can even click the link there which 
automatically enables the API, but I wanted to go through the console so I 
see exactly what happens and how to do it myself.)

Another thing what misled me was that *all *of the APIs were enabled in the 
*Dashboard 
*view, and it took me a while to go to the *Library *menu on the left in 
order to find the missing API. I don't know if this happens to others, too. 
It might be helpful to add a sentence or two in the tutorial regarding this.

I can confirm that for me it did not make any difference if the 
*cloudsql-connection-string* was put in quotes or not.

Thanks again and happy Easter! :)

Best,
 Tas

On Wednesday, April 12, 2017 at 9:25:40 PM UTC+2, Zdenko Hrcek wrote:
>
> Hi Tas,
>
> I made the smae mistake and I spent some time solving it: in app.yaml 
> file, database connection name needs to be in strings like this:
>
> beta_settings:
>     cloud_sql_instances: 'cm-platform-01:europe-west1:cm-db-develop' 
>
>
> I wrote recently blog post about running GAE Flex and Django, maybe some 
> of it will be helpful to you. 
> https://www.the-swamp.info/blog/google-app-engine-flexible/
>
> Zdenko
>
>
> On Wednesday, April 12, 2017 at 8:33:53 PM UTC+2, 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 [email protected].
To post to this group, send email to [email protected].
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/5544f88b-a0d1-4e17-ae13-195b1ef4772b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to