Closed moraes closed 11 years ago
Hmm...I wonder where a good place would be to put this information? Having not tested cloud sql myself I'm reluctant to add something like this to "playhouse", but it does seem like useful information to put somewhere...Maybe I'll add a new section to the docs.
Google recommends using MySQLdb over their rdms driver whenever possible. See this page of their documentation: https://developers.google.com/appengine/docs/python/cloud-sql/ Below is what I ended up doing to get peewee to work in both development and production. Along with the changes in my fork of peewee.
if (os.getenv('SERVER_SOFTWARE') and
os.getenv('SERVER_SOFTWARE').startswith('Google App Engine/')):
db = MySQLDatabase('<db_name>', unix_socket='/cloudsql/<instance_name>', user='root')
else:
db = MySQLDatabase('<db_name>', user='user', passwd='password')
For the record, here's a recipe to use Peewee with Google Cloud SQL on App Engine Python SDK. Cloud SQL uses MySql, so the only difference is the connection:
It works like a charm.