简体   繁体   中英

Django on AWS Elastic Beanstalk - No module named MySQLdb Error

I have been using AWS Elastic Beanstalk to run this web app for a while with no issues on Amazon's Linux version Python 2.7 running on 64bit Amazon Linux/ 2.0.1 .

When I tried to " upgrade " to the latest Amazon Linux version: Python 2.7 version, Linux/ 2.7.7 or any version after 2.0.1 , I get this error:

ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb.

Did you install mysqlclient or MySQL-python?

I do have both installed and included in my requirements.txt file

MySQL-python==1.2.5
mysqlclient==1.3.14

I tried reinstalling them both and removing them one or the other from the requirements but still no luck.

in my .ebextensions I do have these:

packages:
    yum:
        python27-devel: []
        libmemcached-devel: []
        gcc: []
        libxml2-devel: []
        libxslt-devel: []

I have added the gcc and libx after that so I know they are not causing the error. (I did not try to remove the python27-devel or the libmemcached-devel

Any ideas?

What has changed beyond 2.0.1 since everything is working correctly running version 2.0.1 and it is not working on any newer EB version?

通过查看过去的工作,我认为您可能需要将mysql-devel添加到.ebextensions文件中的yum部分

This happened to me as well, from what I can remember is you might need to rebuild the virtual env. In the elastic beanstalk console. Or using the eb command line interface.

而是安装

$ apt-get install python-mysqldb 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM