Thanks, Massimo.

FYI, some more info that might be helpful in your investigation:

Google docs tell me that my app is granted access to the SQL instance by 
default, as it is in the same project with the Cloud SQL license, so 
there's nothing to do there. Also, I set a password for the root user in 
the data base user management menu. The I created two environment variables 
in app.yaml as proposed by Google. 

Then I tried a temporary hack in *google_adapters.py* to send user name and 
pasword to Google SQL, but the connection was still refused. I hope I did 
something wrong and you will be able to pinpoint it:

class GoogleSQLAdapter(UseDatabaseStoredFile, MySQLAdapter):
    uploads_in_blob = True

    REGEX_URI = re.compile('^(?P<instance>.*)/(?P<db>.*)$')

    def clear_cache(self):
        ndb.get_context().clear_cache()

    def ignore_cache_for(self, entities = None):
        entities = entities or []
        ndb.get_context().set_cache_policy(lambda key: key.kind() not in 
entities)

    def __init__(self, db, uri='google:sql://realm:domain/database',
                 pool_size=0, folder=None, db_codec='UTF-8',
                 credential_decoder=IDENTITY, driver_args={},
                 adapter_args={}, do_connect=True, after_connection=None):

        self.db = db
        self.dbengine = "mysql"
        self.uri = uri
        self.pool_size = pool_size
        self.db_codec = db_codec
        self._after_connection = after_connection
        if do_connect: self.find_driver(adapter_args, uri)
        self.folder = folder or pjoin('$HOME',THREAD_LOCAL.folder.split(
                os.sep+'applications'+os.sep,1)[1])
        ruri = uri.split("://")[1]
        m = self.REGEX_URI.match(ruri)
        if not m:
            raise SyntaxError("Invalid URI string in SQLDB: %s" % self.uri)
        instance = credential_decoder(m.group('instance'))
        self.dbstring = db = credential_decoder(m.group('db'))
        driver_args['instance'] = instance
        
*        #KK's addition to attempt fix 2nd gen problem with missing user 
name and password:*
*        driver_args['user'] = os.environ.get('CLOUDSQL_USER')*
*        driver_args['password'] = os.environ.get('CLOUDSQL_PASSWORD')*
        
        if not 'charset' in driver_args:
            driver_args['charset'] = 'utf8'
        self.createdb = createdb = adapter_args.get('createdb',True)
        if not createdb:
            driver_args['database'] = db
            
*        #KK added this for debug:*
*        print "DEBUG: driver args = " + str(driver_args) *   
            
        def connector(driver_args=driver_args):
            return rdbms.connect(**driver_args)
        self.connector = connector
        if do_connect: self.reconnect()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to