There are 2 ways to include libraries in Google App Engine.
libraries: directive in app.yaml
Using libraries: directive in app.yaml to request a library.
libraries:- name: PIL version: "1.1.7"- name: lxml version: "latest"
There are less than 30 built-in libraries supported.
Install any third-party library
In you project directory, create a lib
directory to store third party libraries.
mkdir lib
Use pip
with -t lib
flag to install libraries into the lib
directory.
pip install -t lib <library_name>
Create appengine_config.py
in the project directory with the following code.
# appengine_config.pyfrom google.appengine.ext import vendor# Add any libraries install in the "lib" folder.vendor.add('lib')
Notes: becareful to avoid using libraries which read/write to local files due to performance impact (Google App Engine doesn't really have local files, where file read/write is actually done over the network to Google Cloud Storage).