Connect Django to PostgreSQL (via psycopg2) on Mac OS X

After successfully installing Django and the EnterpriseDB version of PostgreSQL, I needed to successfully install the PostgreSQL adapter for Python (psycopg2) before I can successfully start Django’s development testing web server. After significant research, here are the two errors encountered and subsequent resolutions I was able to find.

Issue #1

Command: pip install psycopg2

Error: pg_config executable not found.

Solution: Enter “PATH=$PATH:/Library/PostgreSQL/9.3/bin” in Terminal and re-execute the install command

ISSUE #2

Command: python manage.py runserver

Error: Library not loaded: libssl.1.0.0.dylib Reason: image not found

Solution: Enter “export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.*/lib” in Terminal and re-execute the runserver comment

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.