2015-11-20 113 views
0

我试图部署Django应用时出现以下错误。我一直在参考文档http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html的教程。我目前的预感是因为pip试图从源代码构建mod_wsgi,而不是使用.whl,但这是我的故障排除专业知识的程度。我该如何解决它?在AWS elasticbeanstalk上为Django部署构建/安装mod_wsgi时出错

[2015-11-20T02:11:22.515Z] INFO [23704] - [Application update/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity execution failed, because: Collecting Django==1.8.6 (from -r /opt/python/ondeck/app/requirements.txt (line 1)) 
    Using cached Django-1.8.6-py2.py3-none-any.whl 
    Collecting mod-wsgi==4.4.7 (from -r /opt/python/ondeck/app/requirements.txt (line 2)) 
    Using cached mod_wsgi-4.4.7.tar.gz 
     Complete output from command python setup.py egg_info: 
     Traceback (most recent call last): 
     File "<string>", line 20, in <module> 
     File "/tmp/pip-build-EAwCnb/mod-wsgi/setup.py", line 140, in <module> 
      'missing Apache httpd server packages.' % APXS) 
     RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages. 

     ---------------------------------------- 
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-EAwCnb/mod-wsgi 
    2015-11-20 02:11:22,510 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 540, 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 (ElasticBeanstalk::ExternalInvocationError) 
caused by: Collecting Django==1.8.6 (from -r /opt/python/ondeck/app/requirements.txt (line 1)) 
    Using cached Django-1.8.6-py2.py3-none-any.whl 
    Collecting mod-wsgi==4.4.7 (from -r /opt/python/ondeck/app/requirements.txt (line 2)) 
    Using cached mod_wsgi-4.4.7.tar.gz 
     Complete output from command python setup.py egg_info: 
     Traceback (most recent call last): 
     File "<string>", line 20, in <module> 
     File "/tmp/pip-build-EAwCnb/mod-wsgi/setup.py", line 140, in <module> 
      'missing Apache httpd server packages.' % APXS) 
     RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages. 

回答

1

对其进行排序。

apsx由httpd-devel软件包提供。使用eb ssh连接然后

yum list installed|grep httpd 

查看哪个版本的httpd-devel与环境相匹配。与

sudo yum install httpd24-devel 

安装,然后

sudo /opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt 

,以检查它的固定。如果这样的作品,然后创建或编辑(本地)文件

.ebextensions/01_packages.config 

或类似的补充,作为部署的一部分:

packages: 
    yum: 
     httpd24-devel: []