Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Can';t在Elastic Beanstalk上部署Django应用程序_Python_Django_Amazon Web Services_Amazon Elastic Beanstalk - Fatal编程技术网

Python Can';t在Elastic Beanstalk上部署Django应用程序

Python Can';t在Elastic Beanstalk上部署Django应用程序,python,django,amazon-web-services,amazon-elastic-beanstalk,Python,Django,Amazon Web Services,Amazon Elastic Beanstalk,在经历了很多困难之后,我终于将我的代码上传到AWS Beanstalk,我希望有人能帮助我解决下一个我看不到解决方案的困难 在我上传(使用'git aws.push')之后,它总是会失败。然后我查看了日志,似乎(作为一个noob)问题在于: 'Target WSGI script not found or unable to stat: /opt/python/current/app/topdish' 我认为这是正确的,我希望它应该位于:'/opt/python/ondeck/app/topd

在经历了很多困难之后,我终于将我的代码上传到AWS Beanstalk,我希望有人能帮助我解决下一个我看不到解决方案的困难

在我上传(使用'git aws.push')之后,它总是会失败。然后我查看了日志,似乎(作为一个noob)问题在于:

'Target WSGI script not found or unable to stat: /opt/python/current/app/topdish'
我认为这是正确的,我希望它应该位于:'/opt/python/ondeck/app/topdish/wsgi.py'

我不知道如何配置它,因为我认为我已经在“.ebextensions”中的“topdish.config”中纠正了它

container_commands:
  01_migrate:    
    command: "python manage.py syncdb --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: topdish/wsgi.py
  - option_name: DJANGO_SETTINGS_MODULE
    value: topdish.settings
我在日志中看到的另一个问题是:

'[2014-11-26T23:11:00.070Z] INFO  [4168]  - [CMD-AppDeploy/AppDeployStage0/EbExtensionPostBuild] : Activity execution failed, because: command failed with error code 1: Error occurred during build: Command 01_migrate failed (Executor::NonZeroExitStatus)'
这可能是相关的,也可能不是

相关日志:


/var/log/eb-activity.log
我认为
'Target WSGI script找不到或无法stat:/opt/python/current/app/topdish'
错误消息是因为您的
容器命令不成功;只有在成功完成所有
container\u命令后,部署挂钩才会将应用程序从
/ondeck
复制到
/current

作为测试,尝试为您的
01\u migrate
容器命令在
leader\u only:true
后面的新行中添加
ignoreErrors:true
。您的应用程序应该部署,但syncdb当然不会运行

container_commands:
  01_migrate:    
    command: "python manage.py syncdb --noinput"
    leader_only: true
    ignoreErrors: true
然后尝试输入python和manage.py的完整路径,而不输入
ignoreErrors

container_commands:
  01_migrate:    
    command: "/opt/python/run/venv/bin/python /opt/python/ondeck/app/manage.py syncdb --noinput"
    leader_only: true
或者可能:

container_commands:
  01_migrate:    
    command: "/opt/python/run/venv/bin/python26 /opt/python/ondeck/app/manage.py syncdb --noinput"
    leader_only: true

不幸的是,最后我改变了很多,同时发现了实际问题。我重新创建了一个AWS Elastic Beanstalk应用程序,并再次尝试,现在它似乎可以工作了


可能是“选项设置”之前的空白行,但不确定。

您是否按照中的说明操作?(您可以简化这一点,因为Python2.7现在在AWS Elastic Beanstalk AMI上可用)是的,我遵循了很多次。发现了一些怪癖:还有,但现在就要开始了。仍然存在此问题:在eb-activity.log中找到“命令失败,错误代码为1”。尽管这不是对您的问题的回答,但正如您所知,eb cli已更新为3.x。这是一种更好的体验,我强烈建议您升级:我很想看到同样失败的cfn-init.log。我想知道您是否遇到了与我相同的问题:与早期AMI一起使用的容器命令现在因Python非字符串错误而失败。我的AWS论坛帖子:。你没有用这个回答你自己的问题。
container_commands:
  01_migrate:    
    command: "/opt/python/run/venv/bin/python /opt/python/ondeck/app/manage.py syncdb --noinput"
    leader_only: true
container_commands:
  01_migrate:    
    command: "/opt/python/run/venv/bin/python26 /opt/python/ondeck/app/manage.py syncdb --noinput"
    leader_only: true