who*_*ate 6 python mysql amazon-web-services flask-sqlalchemy
问题
我正在尝试使用小型数据库后端在 Elastic Beanstalk 上部署一个非常简单的应用程序。我尝试将安装mysqlclient
作为 AWS此处概述的过程的一部分。但是,当我部署我的应用程序时,我从我的 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
Run Code Online (Sandbox Code Playgroud)
题
这mysqlclient
是 AWS 推荐的使用 Flask 或 Django 连接到 RDS 中的 MySQL 数据库的驱动程序。如何使用 Elastic Beanstalk 安装它?
语境
我试图实现我的架构:(1)数据库中的弹性魔豆环境或(2)定期部署RDS实例外弹性魔豆环境。在这种情况下,我们将使用选项 (1)。
我不能很容易地apt-get
按照这里的建议安装 mysql-server 或其他软件包,这就是为什么我希望这不会被标记为重复。我无权访问底层服务器。我尝试使用平台挂钩和 .ebextensions,但我无法让它发挥作用。在这篇文章中,我试图退后一步,看看是否还有其他途径。
对于 Amazon linux 2,您应该能够使用yum
. 因此,您可以在您的.ebextensions
文件中包含一个名为,例如01_packages.config
内容的文件:
packages:
yum:
MySQL-python: []
Run Code Online (Sandbox Code Playgroud)
如果需要更多,您可以添加更多 yum 依赖项。
归档时间: |
|
查看次数: |
1291 次 |
最近记录: |