使用psycopg2 AWS ElasticBeanstalk amazon linux pg_config错误

时间:2016-08-12 06:19:03

标签: postgresql amazon-web-services amazon-elastic-beanstalk

我正在测试AWS以启动Web服务。 我坚持使用pg_config。错误日志是

/app/requirements.txt (line 1))
Using cached psycopg2-2.6.2.tar.gz
  Complete output from command python setup.py egg_info:
  running egg_info
  creating pip-egg-info/psycopg2.egg-info
  writing pip-egg-info/psycopg2.egg-info/PKG-INFO
  writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
  writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
  writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
  warning: manifest_maker: standard file '-c' not found

  Error: pg_config executable not found.

  Please add the directory containing pg_config to the PATH
  or specify the full executable path with the option:

      python setup.py build_ext --pg-config /path/to/pg_config build ...

  or with the pg_config option in 'setup.cfg'.

stackoverflow中有很多解决方案,但它对我不起作用。

  packages:
  yum:
    python-devel: []
    postgresql95-devel: []
    libjpeg-devel: '6b'

container_commands:
  01_migrate:
    command: "python manage.py migrate"
  02_collectstatic:
    command: "python manage.py collectstatic --noinput"
  03_createsu:
    command: "python manage.py createsu"
    leader_only: true

option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "onreview.settings"
    PYTHONPATH: "$PYTHONPATH"
  "aws:elasticbeanstalk:container:python":
    WSGIPath: "onreview/wsgi.py"

这是我的.ebextensions / python.config文件内容。我正在通过压缩我的源代码上传。

我将postgresql95-devel改为postgresql-devel,93,94,全部。我现在使用9.5版db。

我认为--pg-config的路径有问题。但我不能改变它。

有没有解决方案?

p.s我不想通过SSH或其他东西在EC2实例中进行设置。

1 个答案:

答案 0 :(得分:1)

您的原始帖子中存在语法错误,packages:不应缩进。当python包含在安装中时,我不知道为什么你有python-devel,所以我不能说它不会干扰。同样,设置python路径的行。

packages:
  yum:
    python-devel: []
    postgresql95-devel: []
    libjpeg-devel: '6b'

container_commands:
  01_migrate:
    command: "python manage.py migrate"
  02_collectstatic:
    command: "python manage.py collectstatic --noinput"
  03_createsu:
    command: "python manage.py createsu"
    leader_only: true

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "onreview.settings"
    PYTHONPATH: "$PYTHONPATH"
  aws:elasticbeanstalk:container:python:
    WSGIPath: "onreview/wsgi.py"