0

Somebody knows if is it possible connect an application from Appengine to a mysql database hosted in compute engine?

I'm trying to do this with python and i have this error:

Can't create TCP/IP socket (-1)

I'm using SqlAlchemy ORM which use the next configuration:

create_engine('mysql+mysqldb://root@ip/database')

and locally works but when i deploy the application to appengine doesn't work.

Thanks

Mykola
  • 3,343
  • 6
  • 23
  • 39

1 Answers1

0

Google App Engine, by default, runs code in a sandboxed environment, meaning that certain aspects of the Python runtime environment are restricted, or respond differently than they would otherwise. One of these aspects is outbound network connectivity—while GAE supports sockets, there are certain restrictions, and sockets are only available for paid apps.

The recommended options for storing information in a GAE app include the App Engine Datastore, Google Cloud SQL, and Google Cloud Storage. Google Cloud SQL is MySQL, and works with SQLAlchemy, so that's probably your best option.

If you absolutely need to run your own MySQL server (rather than using Google Cloud SQL) and connect to it from a GAE app, the other option is to use the managed VM environment, which permits unrestricted network access (since it's essentially a Google Compute Engine VM with the App Engine runtime on top).

Community
  • 1
  • 1
Kurt Raschke
  • 960
  • 9
  • 19