Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access Google Cloud SQL instance in dev_appserver with Django

I recently updated my GAE SDK and soon after the update, it has started acting up. I am using Google Cloud SQL in backend with Django 1.4.3. On my local dev server, it gives the following error :

No valid OAuth 2.0 credentials. Before using the Google SQL Service backend on dev_appserver, you must first run "manage.py syncdb" and proceed through the given instructions to fetch an OAuth 2.0 token.

I have tried removing cacert.txt as well as removing google sql authentication from my home directory to re-obtain authentication via running python manage.py syncdb, but it does not help.

The same question has been raise here with a "patch" provided:

http://code.google.com/p/googleappengine/issues/detail?id=9006

I tried changing my server.py as per the patch. But no effect.

Any help ?

like image 676
user2243088 Avatar asked Nov 12 '22 07:11

user2243088


1 Answers

I had the same problem, and this solved it for me:

  1. copy the refresh_token from the google oauth .dat json file
  2. added in app.yaml:

env_variables: GOOGLE_SQL_OAUTH2_REFRESH_TOKEN: "here the copied token"

like image 153
Peter Avatar answered Nov 14 '22 23:11

Peter