Solve the connection problem between Django Elastic Beanstalk and RDS MySQL
P粉716228245
P粉716228245 2023-08-28 20:40:41
0
1
593
<p>I'm trying to connect my Django Elastic Beanstalk to my RDS MySQL. My Django is working fine with my RDS MySQL via localhost, but when I try to upload my Django to Elastic Beanstalk I get the error "Deployment application failed" and AWS shows the following error. My project has mysqlclient in requirements.txt like shown here: </p> <p>https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html</p> <p>According to the page, this should be enough. I've certainly tried searching for similar issues, but so far without success. I noticed that many questions mention the need to have a packages.config file in the .ebextensions folder and I tried many of those suggestions without success. Is this a problem? Why isn't this mentioned on the AWS page? </p> <pre class="brush:php;toolbar:false;">× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [16 lines of output] /bin/sh: mysql_config: command not found /bin/sh: mariadb_config: command not found /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-r0dz9d2g/mysqlclient_f2b5c53e43a648c284b06f7af63d9855/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-r0dz9d2g/mysqlclient_f2b5c53e43a648c284b06f7af63d9855/setup_posix.py", line 70, in get_config libs = mysql_config("libs") File "/tmp/pip-install-r0dz9d2g/mysqlclient_f2b5c53e43a648c284b06f7af63d9855/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found mysql_config --version mariadb_config --version mysql_config --libs [end of output]</pre></p>
P粉716228245
P粉716228245

reply all(1)
P粉777458787

Answer your own question. Later I asked a similar questionAWS Elastic Beanstalk RDS MacOS mysqlclient not workingand got help.

The answer is indeed the packages.config file, which is required to install via yum (please refer to the link above). There's something else going wrong in my code, but I'm getting the same error as above, even though packages.config is set correctly. I found this issue because I tried setting it back to a SQLite database and uploading to Elastic Beanstalk, but it didn't work. (Sorry, I can't remember what error I got, I was nervous, I think it was a "111: Connection refused" error.)

The way I got things working was to delete all the config files and start over with a regular finished project and follow the tutorial (like I did before): https://docs.aws .amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html#python-rds-connect

From there, I added a packages.config file in my .ebextensions folder with the following code...

packages: 
  yum:
    python3-devel: []
    mariadb-devel: []

...as mentioned in the other question I linked above, and here: mysqlclient installation error in AWS Elastic Beanstalk

I also need gunicorn and a Procfile, but I've solved this problem before, but if you're here because of issues with Elastic Beanstalk and RDS, it's worth mentioning as well.

I also don't understand if I can use yum in the packages.config file if I don't have yum on my computer, especially since I'm using MacOS and using yum on MacOS is not common. This question is answered in another question I linked above, and the answer is that you don't need to install yum on your machine in this case because yum is used by Elastic Beanstalk's Amazon Linux 2 server in this case of.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!