Google App Engine - Running GAE inside a virtualenv

To be able to work with Google App Engine inside a virtualenv environment, we have to do some tricks:

1. Download and extract the Google App Engine SDK for Python:

+ Link:

+ Extract the zip file to /opt directory. So, the directory path for GAE is something like:


2. Open the activate script of the virtualenv environment at /home/.venv/myenv/bin/activate:

+ Find the line:

export PATH

+ Insert the GAE path:

export PATH

Save & exit

3. Create a path configuration file for GAE inside the virtualenv environment name /home/.venv/myenv/lib/python2.7/site-packages/gae.pth with the following content:

import dev_appserver; dev_appserver.fix_sys_path()

Now you can run your GAE application inside a virtualenv environment.

If you get trouble with GAE does not regconize any python libraries, modify your app.yaml to list those libraries. For example, if i want to use jinja2 template library, my app.yaml will look something like this:

application: dangtrinhnt
version: 1
runtime: python27
api_version: 1
threadsafe: true
- name: jinja2
  version: latest
- name: markupsafe
  version: latest

- url: /.*