【发布时间】:2020-12-11 06:08:38
【问题描述】:
问题
我正在尝试在 Elastic Beanstalk 上部署一个非常简单的应用程序,并带有一个小型数据库后端。我尝试安装 mysqlclient 作为 AWS here 概述的过程的一部分。但是,当我部署我的应用程序时,我从 Elastic Beanstalk 日志中收到以下错误,因为它尝试下载包:
Collecting mysqlclient
Using cached mysqlclient-2.0.1.tar.gz (87 kB)
2020/08/21 20:30:16.419082 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr: ERROR: Command errored out with exit status 1:
command: /var/app/venv/staging-LQM1lest/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bz45889a/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bz45889a/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1tyle8mv
cwd: /tmp/pip-install-bz45889a/mysqlclient/
Complete output (12 lines):
/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 1, in <module>
File "/tmp/pip-install-bz45889a/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-bz45889a/mysqlclient/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-bz45889a/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
问题
mysqlclient 是 AWS 推荐的驱动程序,用于使用 Flask 或 Django 连接到 RDS 中的 MySQL 数据库。如何使用 Elastic Beanstalk 安装它?
上下文
我尝试使用 (1) Elastic Beanstalk 环境内 的数据库或 (2) Elastic Beanstalk 外 定期部署的 RDS 实例来实现我的架构环境。在这种情况下,我们将使用选项 (1)。
我不能很容易地使用apt-get 和suggested here 安装mysql-server 或其他软件包,这就是为什么我希望这不会被标记为重复。我无权访问底层服务器。我尝试使用平台挂钩和.ebextensions,但我wasn't able to get that to work。在这篇文章中,我试图退后一步,看看是否还有其他途径。
【问题讨论】:
标签: python mysql amazon-web-services flask-sqlalchemy