簡體   English   中英

無法找出 Heroku 應用程序失敗的地方 [錯誤:找不到 pg_config 可執行文件。]

[英]Can't figure out where Heroku app is failing [Error: pg_config executable not found.]

希望你能幫我解決這個問題。 我正在瀏覽Heroku 的“Python 入門”頁面,您可以在其中安裝必要的依賴項以在本地運行應用程序。 直到第二步到最后一步,運行命令virtualenv venv之前,一切都運行良好。 我運行它,然后執行下一個命令pip install -r requirements.txt --allow-all-external ,這就是我收到此錯誤的地方:

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'.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_nickcode/psycopg2
Storing debug log for failure in /tmp/tmpb5tCeK

我不明白為什么我會收到這個錯誤。 任何人都可以幫助我理解它嗎?

我的requirements.txt版本:

dj-database-url==0.3.0
Django==1.8.1
django-postgrespool==0.3.0
gunicorn==19.3.0
psycopg2==2.6
SQLAlchemy==1.0.4
whitenoise==1.0.6

pg_config 是 postgresql ( http://www.postgresql.org/docs/8.1/static/app-pgconfig.html ) 的一部分。 所以你需要安裝postgresql。

brew install postgresql

在 macOS 上解決了這個問題

我已經克服了這個問題,定義了一個環境變量 HEROKU 並將以下幾行放在 settings.py 的末尾

if config('HEROKU', cast=bool, default=False):
    import django_heroku

    django_heroku.settings(locals())

此外,我在 Procfile 中包含了一個工人來安裝 django-heroku 僅用於 Heroku

worker: python -m pip install django-heroku
release: python manage.py migrate --noinput
web: gunicorn myapp.wsgi --log-file -

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM