Question

Is there a way to import 3rd party libraries to GAE in a way that is not manual?

i.e. not the solution mentioned here:
How to include third party Python libraries in Google App Engine?

The ideal would be to pip install -r requirements.txt into a virtualenv, then somehow make that library available in the local GAE development server, and of course on GAE itself.

Was it helpful?

Solution

If you are already using pip and virtualenv, you need to create symlinks from ./lib/python2.7/site-packages/"libxxx" to your GAE project directory (where . is the root of your virtualenv directory, and libxxx is the name of the 3rd party library you're willing to install).

If there are symbolic links in your GAE project, then appcfg.py will resolve these links when publishing your app on Google's infrastructure.

For example, on Mac OS X, to install HTTPlib on GAE, I did the following:

ln -s ~/Projets/myproject/lib/python2.7/site-packages/httplib2/ ~/Projets/myproject/src/packages/libs/httplib2/

After that, provided your code is somewhere inside ~/Projets/myproject/src, you can use the library using: from packages.libs import httplib2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top