ImportError: no module named **** Error in the Google engine

I am developing my application in Google App Engine, now I use Google Cloud SQL. It works fine on the local host, but when I deploy my application to the server, it gives me the following error.

ImportError: No module named MySQLdb 

Later I copied the MySQLdb package to the application directory. Now he gives me an error

 ImportError: No module named _mysql. 

What am I doing wrong here, Any recommendations?

+6
source share
3 answers

MySQLdb may not be present in your app.yaml application. This library should be there for the Google App Engine to download it for your instance. Hope this helps.

 libraries: - name: MySQLdb version: "latest" 
+7
source

Look at documents that don't seem to be the way you do it.

Creating an application with a local MySQL instance

 from google.appengine.api import rdbms CLOUDSQL_INSTANCE = '' DATABASE_NAME = 'guestbook' USER_NAME = 'username' PASSWORD = 'password' def get_connection(): return rdbms.connect(instance=CLOUDSQL_INSTANCE, database=DATABASE_NAME, user=USER_NAME, password=PASSWORD, charset='utf8') 
0
source

This tutorial has earned my application ...

What I did: I created a very simple project (only one simple application with one model) and watched the tutorial so that it worked in my development environment and in GAE. Then I transferred my code from my old (non-GAE) project to a new project. Everything was fine.

The bad news: some effort is still needed to get the new project deployed correctly in GAE and Cloud SQL. I never managed to get it to work at a time. You should carefully study the GAE magazines.

0
source

All Articles