无效requirements.txt上部署Django应用到AWS魔豆 [英] Invalid requirements.txt on deploying django app to aws beanstalk

查看:394
本文介绍了无效requirements.txt上部署Django应用到AWS魔豆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在部署我的应用程序没有任何问题的豆茎环境,直到我的最新承诺。

现在我得到这个

 时间类型详细信息
2013年9月1日10点19分十二秒UTC + 0800错误无法部署应用程序。
[I-50f40d06]收到了2013年9月1日10点19分11秒UTC + 0800错误的反应,但命令失败。
2013年9月1日十时19分11秒UTC + 0800错误您r​​equirements.txt是无效的。快照您的日志了解详细信息。
2013年9月1日十时19分11秒UTC + 0800错误[实例:I-50f40d06模块:AWSEBAutoScalingGroup ConfigSet:钩形preAppDeploy]未能在实例,返回code:编译过程中出现错误:1输出:命令挂钩失败。
 

快照日志这样说:

  2013年9月1日02:19:08852 [信息](9941 MainThread)directoryHooksExecutor.py-29] [根directoryHooksExecutor信息]输出从脚本:在新的Python可执行/ OPT /蟒蛇/运行/ venv /斌/ python2.6的
不覆盖现有python脚本的/ opt /蟒蛇/运行/ venv /斌/ Python的(必须使用/opt/python/run/venv/bin/python2.6)
安装distribute..................................................................................................................................................................................................done.
安装PIP ................完成。
2013年9月1日02:19:08564错误错误安装的依赖:命令/选择/蟒蛇/运行/ venv /斌/ PIP安装--use镜-r /opt/python/ondeck/app/requirements.txt返回非零退出状态-9
回溯(最近通话最后一个):
  文件/opt/elasticbeanstalk/hooks/appdeploy/$p$p/03deploy.py31行,在主
    install_dependencies()
  文件/opt/elasticbeanstalk/hooks/appdeploy/$p$p/03deploy.py25行,在install_dependencies
    壳=真)
  文件/usr/lib/python2.6/subprocess.py,线路502,在check_call
    提高CalledProcessError(RET code,CMD)
CalledProcessError:命令/选择/蟒蛇/运行/ venv /斌/ PIP安装--use镜-r /opt/python/ondeck/app/requirements.txt返回非零退出状态-9

2013年9月1日02:19:08853 [错误](9941 MainThread)directoryHooksExecutor.py-34] [根directoryHooksExecutor错误]脚本失败,返回code 1
2
 

我requirements.txt是和以前一样。我试着在requirements.txt去除一切很好,但我再次得到了同样的错误这让我觉得这个问题是requirements.txt在运行之前。

我不知道哪些东西被部署的顺序。总之,这里是我的配置文件:

 套餐:
  百胜:
    的libjpeg-devel软件包:6B
    zlib的-devel软件包:[]
    FreeType的-devel软件包:[]


container_commands:
  01_install_mysqldb:
    命令:PIP安装分发== 0.6.28; PIP安装mysql-python的;
  02_syncdb:
    命令:蟒蛇manage.py的SyncDB --noinput
    leader_only:真
  03_createadmin:
    命令:Python脚本/ createadmin.py
    leader_only:真
  04_collectstatic:
    命令:蟒蛇manage.py collectstatic --noinput
  05_migrate_wizards:
    命令:蟒蛇manage.py迁移向导--noinput
    leader_only:真
  06_migrate_facebook:
    命令:蟒蛇manage.py迁移的Facebook --noinput
    leader_only:真
  07_migrate_socialaccount:
    命令:蟒蛇manage.py迁移socialaccount 0011 --noinput
    leader_only:真
  08_migrate_missions:
    命令:蟒蛇manage.py迁移任务--noinput
    leader_only:真
  09_migrate_mailchimp:
    命令:蟒蛇manage.py迁移mailchimp --noinput
    leader_only:真
  10_migrate_actstream:
    命令:蟒蛇manage.py迁移actstream --noinput
    leader_only:真

option_settings:
   - 命名空间:AWS:elasticbeanstalk:容器:蟒蛇
    option_name的:WSGIPath
    值:ideatory / wsgi.py
   - 命名空间:AWS:elasticbeanstalk:容器:蟒蛇:staticfiles
    option_name的:/静态/
    价值:静态/
   -  option_name的:DJANGO_SETTINGS_MODULE
    值:ideatory.settings
 

解决方案

我有完全相同的问题。这为我工作的唯一的事是(自动)重建我的整个环境。你可以做,在AWS控制台。转到您的环境,并单击操作>重建环境。这将需要一些时间,之后它会自动重新启动您的应用程序没有这个错误。

更新:

问题不断,现在,然后返回等等。我想通了,事情错了点子编译 psycopg ,这是需要PostgreSQL的支持时。还没有找到真正的解决办法呢。

I have been deploying my app without any issues to the beanstalk environment until my latest commit.

Now I get this

Time    Type    Details
2013-09-01 10:19:12 UTC+0800    ERROR   Failed to deploy application.
2013-09-01 10:19:11 UTC+0800    ERROR   Responses from [i-50f40d06] were received, but the commands failed.
2013-09-01 10:19:11 UTC+0800    ERROR   Your requirements.txt is invalid. Snapshot your logs for details.
2013-09-01 10:19:11 UTC+0800    ERROR   [Instance: i-50f40d06 Module: AWSEBAutoScalingGroup ConfigSet: Hook-PreAppDeploy] Failed on instance with return code: 1 Output: Error occurred during build: Command hooks failed .

The snapshot logs say this:

2013-09-01 02:19:08,852 [INFO] (9941 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: New python executable in /opt/python/run/venv/bin/python2.6
Not overwriting existing python script /opt/python/run/venv/bin/python (you must use /opt/python/run/venv/bin/python2.6)
Installing distribute..................................................................................................................................................................................................done.
Installing pip................done.
2013-09-01 02:19:08,564 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install --use-mirrors -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status -9
Traceback (most recent call last):
  File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 31, in main
    install_dependencies()
  File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 25, in install_dependencies
    shell=True)
  File "/usr/lib/python2.6/subprocess.py", line 502, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install --use-mirrors -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status -9

2013-09-01 02:19:08,853 [ERROR] (9941 MainThread) [directoryHooksExecutor.py-34] [root directoryHooksExecutor error] Script failed with returncode 1
2

My requirements.txt is the same as before. I tried removing everything in the requirements.txt as well but I get the same error again which makes me think the problem was before requirements.txt was run.

I don't know the order in which things are deployed. ANyway, here is my config file:

packages:
  yum:
    libjpeg-devel: '6b'
    zlib-devel: []
    freetype-devel: []


container_commands:
  01_install_mysqldb:
    command: "pip install distribute==0.6.28; pip install mysql-python;"
  02_syncdb:
    command: "python manage.py syncdb --noinput"
    leader_only: true
  03_createadmin:
    command: "python scripts/createadmin.py"
    leader_only: true
  04_collectstatic:
    command: "python manage.py collectstatic --noinput"
  05_migrate_wizards:
    command: "python manage.py migrate wizards --noinput"
    leader_only: true
  06_migrate_facebook:
    command: "python manage.py migrate facebook --noinput"
    leader_only: true
  07_migrate_socialaccount:
    command: "python manage.py migrate socialaccount 0011 --noinput"
    leader_only: true
  08_migrate_missions:
    command: "python manage.py migrate missions --noinput"
    leader_only: true
  09_migrate_mailchimp:
    command: "python manage.py migrate mailchimp --noinput"
    leader_only: true
  10_migrate_actstream:
    command: "python manage.py migrate actstream --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: ideatory/wsgi.py
  - namespace: aws:elasticbeanstalk:container:python:staticfiles
    option_name: /static/
    value: static/
  - option_name: DJANGO_SETTINGS_MODULE
    value: ideatory.settings

解决方案

I had the exact same problem. The only thing that worked for me was (automatically) rebuilding my entire environment. You can do that in the AWS console. Go to your environment and click Actions > Rebuild Environment. This will take some time, afterwards it will automatically relaunch your app without this error.

Update:

The problem keeps returning so now and then. I figured out that something is going wrong when pip compiles psycopg, which is needed for postgreSQL support. Haven't found a real solution yet.

这篇关于无效requirements.txt上部署Django应用到AWS魔豆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆