Reputation: 109
I am trying to add a database to a new python app. Postgres is my db of choice, it works on my machine with many rails apps, is up and running, and I have created a db for my project.
Troubleshooting so far:
pip install psycopg2
render looks appropriate:
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /usr/local/lib/python2.7/site-packages
Cleaning up...
ok, testing it
python
>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib
Referenced from: /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
Reason: image not found
Looks like a module problem.
In my bash_profile I am exporting the correct version of psql:
export PATH=/usr/pgsql-9.3/bin:"$PATH"
My database settings shouldn't matter as it fails the test before I start running a server but:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'firstBlog',
'USER': 'ML',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
Of course, attempting to run the server will also crash it.
Brew Doctor is not turning up any errors. Any ideas where I can continue to troubleshoot?
Upvotes: 1
Views: 841
Reputation: 109
In this case, it seems that my environmental variables weren't exporting psql properly for Django. I found a solution on the page linked by @karthikr that solved it.
https://stackoverflow.com/a/16740552/2967262
Upvotes: 1