python的lib文件夹在哪_如何导入模块中的lib文件夹

谷歌云平台技术解决方案代表Adam:Modules documentations may not be explicitly

stated, but the folder 'Module1', 'Module2' as well as the default

module actually run inside separate Python virtual environments on

separate instances and need to be self contained. They cannot 'see'

any directories above them which exist on the local filesystem, and

'default.py' can't see anything in each of the module directories. The

whole folder tree isn't copied to each module instance.

他建议不要创建符号链接,只需将./lib复制到每个模块。在

我不太喜欢这个主意。在

首先,这些模块共享一些基类,复制它们确实是一种反模式。在

其次,到处复制lib文件夹会破坏单元测试,因为nose会尝试运行它可以运行的所有单元测试,这也是因为显式地排除目录是一件痛苦的事情。在

最后,我写了一个makefile来帮助部署/测试更容易。。。在# Create simlinks before deployment.

deploy: mksimlnks

appcfg.py oauth2 update $(CURDIR)/app.yaml

appcfg.py oauth2 update $(CURDIR)/MODULE_1/module_1.yaml

appcfg.py oauth2 update $(CURDIR)/MODULE_2/module_2.yaml

appcfg.py oauth2 update_queues $(CURDIR)

mksimlnks:

ln -s $(CURDIR)/lib $(CURDIR)/MODULE_1/lib

ln -s $(CURDIR)/lib $(CURDIR)/MODULE_2/lib

# Need to remove symlinks before unittest

# or unit test will explode.

test: rmsimlnks

nosetests exclude-dir=lib with-gae -w $(CURDIR) with-coverage cover-html

# Remove all symlinks

rmsimlnks:

rm -rf $(shell find * -type l)

# remove symlinks and other stuff

clean: rmsimlnks

rm -f $(shell find * -name *.pyc)

rm -f $(shell find * -name .DS_Store)

rm -f .coverage

rm -rf $(CURDIR)/cover

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值