简体   繁体   中英

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

Hoping you can help me figure this one out. I'm slogging through the Heroku 'Getting Started with Python' page where you install the necessary dependencies to run an app locally. It all works well up until the 2nd to last step, running the command virtualenv venv . I run that, then the next command, pip install -r requirements.txt --allow-all-external , and that's where I get this error:

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

I don't understand why I'm getting this error. Can anyone help me make sense of it?

My version of 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 is part of postgresql ( http://www.postgresql.org/docs/8.1/static/app-pgconfig.html ). So you need to install postgresql.

brew install postgresql

在 macOS 上解决了这个问题

I have overcame this issue defining a environment variable HEROKU and putting the following lines at the end of settings.py

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

    django_heroku.settings(locals())

Additionally, I've include an worker in Procfile to install the django-heroku just for use in Heroku

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM