我正在尝试在AWS上部署应用程序,但是遇到此错误,无法找到使其正常工作的方法。
错误:
构建期间发生错误:命令设置工具失败
01_packages.config
packages:
yum:
git: []
postgresql-devel: []
libjpeg-turbo-devel: []
commands:
setuptools:
command: /opt/python/run/venv/bin/pip install setuptools --upgrade
我想AWS最近发生了变化,因为这在我以前的部署中一直有效。
还必须更改
postgresql93-devel: []
到
postgresql-devel: []
因为它先前提供了以下错误:
您没有可安装的postgresql93-devel
db-migrate.congig
container_commands:
01_migrate:
command: "django-admin.py migrate --noinput"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: app_name.settings
django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: yantraksh_cargo/wsgi.py
wsgi_custom.config
files:
"/etc/httpd/conf.d/wsgihacks.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On
此失败,因为文件/opt/python/run/venv/bin/pip
不存在。至少不在Amazon Linux 2(python env)上。
要解决此问题,您可以使用
commands:
setuptools:
command: pip install setuptools --upgrade
要检查它是否有效,我在测试EB环境(64bit Amazon Linux 2 v3.0.1 running Python 3.7
)上进行了[[验证:
2020-05-28 07:47:14,369 P3704 [INFO] Command setuptools
2020-05-28 07:47:16,759 P3704 [INFO] -----------------------Command Output-----------------------
2020-05-28 07:47:16,759 P3704 [INFO] Collecting setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Downloading setuptools-46.4.0-py3-none-any.whl (583 kB)
2020-05-28 07:47:16,759 P3704 [INFO] Installing collected packages: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Attempting uninstall: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Found existing installation: setuptools 38.4.0
2020-05-28 07:47:16,759 P3704 [INFO] Uninstalling setuptools-38.4.0:
2020-05-28 07:47:16,760 P3704 [INFO] Successfully uninstalled setuptools-38.4.0
2020-05-28 07:47:16,760 P3704 [INFO] Successfully installed setuptools-46.4.0
编辑:这里概述了从Amazon Linux 1到2的一般迁移步骤: