弹性 Beanstalk: /bin/sh: /opt/python/run/venv/bin/activate: 没有该文件或目录

3
尝试部署使用channels的Django应用,按照此链接中的步骤:https://medium.com/@elspanishgeek/how-to-deploy-django-channels-2-x-on-aws-elastic-beanstalk-8621771d4ff0 这是我的配置文件: 01_env.config
option_settings:  
  aws:elasticbeanstalk:container:python:     
    WSGIPath: "dashboard/wsgi.py"
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "dashboard.settings"
    PYTHONPATH: /opt/python/current/app/dashboard:$PYTHONPATH

  aws:elbv2:listener:80:
    DefaultProcess: http
    ListenerEnabled: 'true'
    Protocol: HTTP
    Rules: ws
  aws:elbv2:listenerrule:ws:
    PathPatterns: /websockets/*
    Process: websocket
    Priority: 1
  aws:elasticbeanstalk:environment:process:http:
    Port: '80'
    Protocol: HTTP
  aws:elasticbeanstalk:environment:process:websocket:
    Port: '5000'
    Protocol: HTTP

02_setup.config

container_commands:
  00_pip_upgrade:
    command: "source /opt/python/run/venv/bin/activate && pip install --upgrade pip"
    ignoreErrors: false
  01_migrate:
    command: "django-admin.py migrate"
    leader_only: true
  02_collectstatic:
    command: "django-admin.py collectstatic --noinput"
  03_wsgipass:
    command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'

当我运行eb create django-env时,它会失败并显示错误信息:Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].在日志中,我发现原因是:
2020-06-17 16:36:41,880 P4189 [INFO] Command 00_pip_upgrade
2020-06-17 16:36:41,883 P4189 [INFO] -----------------------Command Output-----------------------
2020-06-17 16:36:41,883 P4189 [INFO]    /bin/sh: /opt/python/run/venv/bin/activate: No such file or directory

尽管我按照指南操作,但目录似乎不存在。我也无法通过SSH连接到EC2实例进行检查。Amazon Linux 2中的Python venv目录是否更改了?


你找到AL2的解决方案了吗? - Daniel
1个回答

2

这无法工作,因为您正在使用 Amazon Linux 2,而您所遵循的教程正在使用 Amazon Linux 1

如果要在创建Python环境时使用 Amazon Linux 1,请选择:

Python 3.6 running on 64bit Amazon Linux

请注意,AL2和AL1之间存在巨大的区别,大多数涉及AL1的教程在AL2中将无法使用。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接