![](/img/trans.png)
[英]I am trying to download Django-heroku. But I am getting this Error: pg_config executable not found., how to solve it?
[英]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.