【问题标题】:Getting error while deploy django apps in aws elastic beanstalk在 aws elastic beanstalk 中部署 django 应用程序时出错
【发布时间】:2018-04-16 01:34:27
【问题描述】:

[实例:i-**********************] 实例上的命令失败。返回代码:1 输出:(截断)...)文件“/usr/lib64/python2.7/subprocess.py”,第 541 行,在 check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/ run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' 返回非零退出状态 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py 失败。有关更多详细信息,请使用控制台或 EB CLI 检查 /var/log/eb-activity.log。

我遇到了这个错误,任何人都可以提供一些关于它发生的原因和原因的图片。

而我的 requirements.txt 是

Django==1.11.4,djangorestframework==3.5.1,psycopg2==2.7.3.1,gunicorn==19.7.0,django-cors-headers==2.1.0,whitenoise==3.3.1,coreapi ==2.3.1,sendgrid==5.2.0,awsebcli==3.5.1,pystan==2.17.0.0

【问题讨论】:

    标签: python django amazon-web-services amazon-ec2 amazon-elastic-beanstalk


    【解决方案1】:

    您的 requirements.txt 应该如下所示:

    Django==1.11.4
    djangorestframework==3.5.1
    psycopg2==2.7.3.1
    gunicorn==19.7.0
    django-cors-headers==2.1.0
    whitenoise==3.3.1
    coreapi==2.3.1
    sendgrid==5.2.0
    awsebcli==3.5.1
    pystan==2.17.0.0
    

    如果您使用

    连接到您的实例
    eb ssh
    

    然后运行

    source /opt/python/run/venv/bin/activate
    source /opt/python/current/env
    pip install -r /opt/python/current/app/requirements.txt
    

    您应该会看到错误。

    汤姆。

    【讨论】:

    • 损坏的意思?
    • 请见上文
    • 和我的项目一样,但我是这样复制粘贴的。
    • 您是否正在使用 yum 安装必要的先决条件?在此处查看示例 ebextensions 文件:stackoverflow.com/questions/47064290/…
    • 只有 postgres 使用 yum 安装。这是我的 .config 文件container_commands: 01_migrate: command: "python manage.py migrate" leader_only: true 02_collectstatic: command: "python manage.py collectstatic --noinput" option_settings: "aws:elasticbeanstalk:application:environment": DJANGO_SETTINGS_MODULE: "pms_backend.settings" PYTHONPATH: "$PYTHONPATH" "aws:elasticbeanstalk:container:python": WSGIPath: "pms_backend/wsgi.py" packages: yum: postgresql95-devel: []
    猜你喜欢
    • 2017-03-04
    • 2022-12-09
    • 2021-10-11
    • 2021-02-11
    • 2020-02-21
    • 2021-06-22
    • 2020-04-29
    • 2015-06-28
    • 2017-06-14
    相关资源
    最近更新 更多