Python PostgreSQL – Why Psycopg2 Fails in Google App Engine dev_appserver.py

google-app-enginepostgresqlpsycopg2python

I want connect my app that are in GAE with ElephantDB. I want use the lib psycopg2 and I found a problem. I installed the lib in local to test it and work perfectly and then I installed the lib in lib folder on my app as I have done many times with other libs.

This time with pip install -t appname/lib/ psycopg2
So, dev server dectect the lib, but say me that :

ImportError: No module named psycopg2._psycopg

At first I thought that the problem was python version that dev_server was executing, but in doc I read that dev runs with 2.7 version and I was doing my tests in 2.7 too. So, I don't understand what is the problem. Why the lib not works fine in dev_server?

Any idea? This problem happens in local, I have not upload the code yet.

Best Answer

I suggest you go back and read the docs on the python sandbox https://cloud.google.com/appengine/docs/python/#Python_The_sandbox once you do you will find that appengine front end is not capable of running psycopg2. You would need to find a pure python postgres lib and have a paid app to have outbound sockets.

Related Question