Using mysqldb with lambda and zappa
Hi,
Following to instructions, simple installing this package, or letting zappa install it does not seem to give me mysqldb within my lambda function. I get
[1489527885652] ImportError: No module named MySQLdb
Am i missing something here? I also checked the package zip and it's not in there either. I am running mac though, do i need to run package on an aws machine?
Are you in a venv?
Yep in a venv on a mac using pycharm.
+1. After deploying with zappa import MySQLdb results in ImportError No module named MySQLdb
Only lambda-packages module is installed, standard MySQLdb module is not.
I'm using Python 3.6 and have the same problem.
I'm also using Python 3.6 and have the same problem !!
Same here.
Silly question, but are you using MySQLdb or mysqlclient? If you're using a venv against the system Python on a Mac, you're using Python 2, instead of Python 3.6. mysqlclient is supposed to be a "drop-in" replacement for MySQLdb, but with Python 3 compatibility:
https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-db-api-drivers
MySQLdb only supports Python 2, and support for it is being dropped in Django 2.0.
Hi @FlipperPA !
I tried to use mysqlclient (with Python3), but many incompatibilities happen, the instance "image" provisioned in lambda does not have libmariaXXX.so (Maria DB / MysqlDB libraries).
But MySQLdb with Python 2 works fine.
I am having this same error.
Error loading MySQLdb module: No module named 'MySQLdb': ImproperlyConfigured
Traceback (most recent call last):
File "/var/task/process.py", line 169, in main
process(record, context)
File "/var/task/process.py", line 133, in process
django.setup()
File "/var/task/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/var/task/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/var/task/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/var/lang/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "