Why PostgreSQL adapter psycopg2 fail in Google App Engine dev_appserver.py?

坚强是说给别人听的谎言 提交于 2020-01-11 11:58:54

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/33707753/why-postgresql-adapter-psycopg2-fail-in-google-app-engine-dev-appserver-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!