Reputation: 3442
The official documentation for Google App Engine with python recommends using a virtualenv and installing third party libs into a subdirectory of the project root:
$ source /path/to/my/virtualenv/bin/activate
$ cd my/project/root
$ mkdir lib
$ pip install -t lib sqlalchemy
The docs then say to make an appengine_config.py
file in the project root with the following content:
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
This all works in the sense that the dev server can find sqlalchemy at run time. However, my virtualenv itself cannot. If I do this
$ python
>>> import sqlalchemy
I get an import error. This makes testing things apart from the dev server awkward/impossible. Is there some pip trick or something similar I can use to make the libs available both from within and without the dev server?
Upvotes: 1
Views: 111
Reputation: 3893
I follow a variation of the same steps but with
$ ln -s {virtualenv}/lib/python2.7/site-packages lib
This way a pip install in the virtualenv automatically goes to the lib directory as well.
Every pip install would then be available to the virtualenv's python and to the dev_appserver without supplying the target folder to make testing things bearable. Eg.:
$ pip install sqlalchemy
Upvotes: 1