我对App Engine项目的zc.buildout
有些困难。我想要buildout在bin/
中生成一个python解释器,其中包含根据path
中指定的库版本所需的app.yaml
调整。这样,只要我有命令行脚本或交互式shell工作,我就可以使用这个生成的python脚本。
这是我要插入的代码:
import dev_appserver
dev_appserver.fix_sys_path()
这是我的buildout.cfg:
[buildout]
parts =
python
gae_sdk
[gae_sdk]
# Downloads and extracts the App Engine SDK.
recipe = appfy.recipe.gae:sdk
url = http://googleappengine.googlecode.com/files/google_appengine_1.8.9.zip
destination = ${buildout:parts-directory}
hash-name = false
clear-destination = true
[python]
recipe = zc.recipe.egg
interpreter = python
initialization =
import dev_appserver
dev_appserver.fix_sys_path()
extra-paths =
${gae_sdk:destination}/google_appengine
${buildout:directory}/app
答案 0 :(得分:2)
原来我错过了zc.recipe.egg的一些魔法,以使其正常工作。这是正确的来源
[buildout]
parts =
python
gae_sdk
[gae_sdk]
# Downloads and extracts the App Engine SDK.
recipe = appfy.recipe.gae:sdk
url = http://googleappengine.googlecode.com/files/google_appengine_1.8.9.zip
destination = ${buildout:parts-directory}
hash-name = false
clear-destination = true
[python]
# use the scripts entry point, not just zc.recipe.egg
recipe = zc.recipe.egg:scripts
interpreter = python
initialization =
import dev_appserver
dev_appserver.fix_sys_path()
# even if empty, must be here or else it errors...
eggs =
extra-paths =
${gae_sdk:destination}/google_appengine
${buildout:directory}/app
哪个生成正确的bin/python
为
#!/usr/local/opt/python/bin/python2.7
import sys
sys.path[0:0] = [
'/path/to/awesome/parts/google_appengine',
'/path/to/awesome/app',
]
import dev_appserver
dev_appserver.fix_sys_path()
...