Saturday, 30 June 2018

Google App Engine SDK: ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql

I am trying to run my Django app on Google App Engine SDK (locally) inside a virtualenv with MySQL as a database. Everything in my requirements.txt file is installing perfectly. When I start the Google App Engine SDK environment, it throws me a nasty error that seems common, but Stack Overflow doesn't have any examples of solving this within Google App Engine SDK yet.
Here is my work flow from the root dir of my project...
virtualenv venv && mkdir lib
source venv
pip install -r requirements.txt -t lib/ && pip install -r requirements.txt
When I run the following command to start up the SDK....
dev_appserver.py app.yaml
I get the following error in my traceback...
File "/Users/username/Repositories/projectname/lib/django/db/utils.py", line 211, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/username/Repositories/projectname/lib/django/db/utils.py", line 115, in load_backend
INFO     2018-06-26 20:09:30,812 module.py:846] default: "GET /_ah/start HTTP/1.1" 500 -
return import_module('%s.base' % backend_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/username/Repositories/projectname/lib/django/db/backends/mysql/base.py", line 30, in <module>
'Did you install mysqlclient or MySQL-python?' % e
ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql.
Did you install mysqlclient or MySQL-python?

My requirements.txt
Django==1.11.8
djangorestframework==3.8.2
facebook-sdk
oauth2client==2.0.1
google-api-python-client==1.6.2
facebookads==2.11.1
httplib2==0.10.3
enum==0.4.6
requests-toolbelt==0.8.0
google-cloud-storage==1.6.0
google-resumable-media==0.3.1
google-auth
requests==2.18.0
lxml==3.8.0
pycrypto==2.6.1
MySQL-python==1.2.5

Contents of lib/ Contents of <code>lib/</code>
I am calling MySQLdb in my app.yaml as well...
libraries:
- name: MySQLdb
  version: "latest"

Some things I have checked off the list while debugging...
1) MySQL-python==1.2.5 is installed when I do a pip freeze in my virtual environment.
2) MySQL is installed and works perfectly on my local computer.
3) I've looked through the lionshare of Stack Overflow's questions thus far and none of them seem to help.


from Google App Engine SDK: ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql

No comments:

Post a Comment