“弹性豆茎上的Django”;要求.txt“;无效
我正在尝试使用Elastic Beanstalk cli部署django项目。我遵循了上的以及本教程。 只要我坚持使用一个新创建的Django项目,并且只使用pip的视图依赖项,Deploymentprocess就可以正常工作 在我的Django项目中尝试时,部署失败,因为“弹性豆茎上的Django”;要求.txt“;无效,django,amazon-elastic-beanstalk,Django,Amazon Elastic Beanstalk,我正在尝试使用Elastic Beanstalk cli部署django项目。我遵循了上的以及本教程。 只要我坚持使用一个新创建的Django项目,并且只使用pip的视图依赖项,Deploymentprocess就可以正常工作 在我的Django项目中尝试时,部署失败,因为requirements.txt无效。我在我的virutalenv中创建了它,如下所示:pip freeze>requirements.txt braintree==3.32.0 cffi==1.9.1 cryptograph
requirements.txt
无效。我在我的virutalenv
中创建了它,如下所示:pip freeze>requirements.txt
braintree==3.32.0
cffi==1.9.1
cryptography==1.7
Django==1.10.4
django-allauth==0.29.0
django-betterforms==1.1.4
django-contrib-comments==1.7.3
django-formtools==1.0
django-payments==0.9.6
django-tinymce==2.4.0
enum34==1.1.6
idna==2.1
ipaddress==1.0.17
oauthlib==2.0.1
Pillow==3.4.2
pyasn1==0.1.9
pycparser==2.17
PyJWT==1.4.2
python-openid==2.2.5
requests==2.12.3
requests-oauthlib==0.7.0
six==1.10.0
stripe==1.43.0
suds-jurko==0.6
xmltodict==0.10.2
在绝望中,我试图一个接一个地激活依赖项。部署过程太慢了,过了一会儿我就放弃了。但现在我知道,Django==1.10.4,Django allauth==0.29.0,Django betterforms==1.1.4,Django contrib comments==1.7.3,Django formtools==1.0和Django tinymce==2.4.0都不是问题。django payments==0.9.6会失败,但这不是导致问题的唯一依赖项
这在我的活动日志中:
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/opt/python/run/venv/bin/python2.7 -c "import setuptools, tokenize;
__file__='/tmp/pip-build-BF9Oen/cffi/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-BsXWzo-record/install-record.txt --single-version-externally-managed --compile --install-headers
/opt/python/run/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-BF9Oen/cffi
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2016-12-13 14:49:05,155 ERROR
Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command
'/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt'
returned non-zero exit status 1 (Executor::NonZeroExitStatus)
我不知道这和丢失的软件有什么关系。我知道如何使用.ebextensions.config
文件,但我不知道缺少什么。有没有办法在本地调试这些问题?通常没有办法在本地调试这些问题,因为人们通常不会在本地机器上运行Amazon linux,而且EB有一个非常特殊的环境设置,不容易复制(至少对我来说不是这样)
如果您想快速完成,只需将ssh连接到您的一个EB/EC2实例,并尝试手动逐个安装pip需求。如果你想把它做好,你必须一个接一个地浏览这个需求列表。(即,从需求文件中的一个需求开始,部署,然后两个需求,然后三个需求,等等)。您可能希望通过添加
pip==9.0.1
在需求文件的顶部,并确保安装了以下Amazon Linux(如果您正在使用):
python-devel
libffi
libffi-devel
# repeat SSH and root privilege steps
$ source /opt/python/run/venv/bin/activate # activate Python environment
$ pip install --upgrade pip # upgrade to latest pip
您似乎对FFI和Python都有问题。您使用了加密技术,但可能没有安装Python和FFI要求以及加密技术的OpenSSL依赖项所需的所有库
$ eb ssh # SSH into your EB environment
$ sudo su # gain root privileges
$ yum install python-devel # or python27-devel
$ yum install libffi-devel # CFFI / FFI requirements
$ yum install openssl-devel # Cryptography requirements
如果Pip投诉,请确保已安装最新的Pip:
python-devel
libffi
libffi-devel
# repeat SSH and root privilege steps
$ source /opt/python/run/venv/bin/activate # activate Python environment
$ pip install --upgrade pip # upgrade to latest pip
要使更改永久化,请将其附加到您的EB配置中。如果您没有直接SSH访问权限,这也可以工作
# .ebextensions/10_packages.config excerpt
packages:
yum:
gcc: []
libffi-devel: []
openssl-devel: []
python-devel: [] # or python27-devel
带有.config
后缀的.ebextensions
文件夹文件是弹性Beanstalk环境的状态声明。也就是说,当您运行eb deploy
或您的CI环境将代码部署到eb时,它们是在每个Elastic Beanstalk部署上运行的指令
Amazon Linux是一种基于RPM的Linux,它使用YUM进行包管理。您会发现RHEL/CentOS/OpenSUSE Python软件包安装说明对Amazon Linux发行版很有帮助。很抱歉响应太晚。在缺少依赖项的地方,您是对的。但是对于我的亚马逊linux版本,我不得不安装python27-devel
而不是python-devel
@LonnyT-Ah,我使用的是python 3(你也应该这么做),错过了你的python 2.7版本。同上!对于libcffi
yum,给出一个未找到的错误。它应该是libffi-devel
。