Skip to content Skip to sidebar Skip to footer

Gae Third Party Libraries (eg. Mysqldb) In Standard Environment

I've struggle with using MySQLdb. In my project (Python 2.7) I had: import MySQLdb In responce: ImportError: No module named MySQLdb. app.yaml: libraries: - name: MySQLdb versio

Solution 1:

The app.yaml file is only used for your application when deployed on App Engine. It specifies some configuration for your deployed app only. So by defining:

libraries:-name:MySQLdbversion:"latest"

it basically instructs the App Engine platform to use that built-in library on the instance to run your code.

Now, as explained here, on your local machine for development, you need to install the library yourself. You can do that by running:

pip install MySQL-python

Note that you don't have to install this library also in the lib folder. This is needed only if the library isn't listed in the Built-in Third-party Libraries so that the library is uploaded along with your app when you deploy it. If it is in the list then referencing it in the app.yaml file is enough.

One last thing about the Cloud Shell. It is a small VM instance provided to you to ease resource management or testing. It isn't meant for development. Every time it starts up a default image is installed (thus any library or OS level tool you installed will be lost). Only your home folder is copied over. Some useful tools are installed by default though on the image like gcloud.

Post a Comment for "Gae Third Party Libraries (eg. Mysqldb) In Standard Environment"