Google App Engine上的Python Eggs [英] Python Eggs on Google App Engine

查看:89
本文介绍了Google App Engine上的Python Eggs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,我将使用virtualenvpip来部署Web应用程序.对于Google App Engine,此操作不起作用,因为所有import语句都是相对于应用程序目录的.

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.

我看到的最常见的方法是简单地将包从site-packages复制到应用程序的目录中.这涉及手工操作,并且容易出错.

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.

另一种方法是更改​​~/.pydisutils.cfg中的install_libinstall_scripts,但这不允许我同时在主目录中使用pip.

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.

对此有什么建议吗?

推荐答案

似乎手动将virtualenv添加到sys.path可以为我解决此问题:

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/'))

这篇关于Google App Engine上的Python Eggs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆