Usually I would use virtualenv
and pip
for deployment of web applications. With Google App Engine this doesn't work, because all import
statement are relative to directory of the application.
The most common approach I saw was to simply copy the packages from site-packages
to the directory of the application. This involves manual work and is error-prone.
Another approach was to changes install_lib
and install_scripts
in ~/.pydisutils.cfg
, but this doesn't allow me to use pip
in my home directory simultaneously.
Do you have an开发者_如何转开发y suggestions for this?
It seems manually adding the virtualenv
to sys.path
solves the problem for me at the moment:
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dev.env/lib/python2.5/site-packages/'))
If you use easy_install instead of pip you can run it with the --install-dir
argument to specify a non-default installation directory.
精彩评论