我想用 pudb 在谷歌应用引擎上调试我的 python 应用程序。我在没有使用 virtualenv 的情况下安装了 buildout 并为其创建了 buildout.cfg 配置文件:
[buildout]
develop = .
parts =
python
app
pudb
nosetests
zipsymlink
eggs =
gaeapp
unzip = true
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}
[app]
recipe = rod.recipe.appengine
url = https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.11.zip
server-script = dev_appserver
src = ${buildout:directory}/src/gaeapp
exclude = tests
zip-packages = True
[pudb]
recipe = zc.recipe.egg
eggs =
gaeapp
pudb
[nosetests]
recipe = zc.recipe.egg
eggs =
NoseGAE
WebTest
gaeapp
nose
extra-paths =
${buildout:directory}/etc
${buildout:directory}/parts/google_appengine
${buildout:directory}/parts/google_appengine/lib/antlr3
${buildout:directory}/parts/google_appengine/lib/fancy_urllib
${buildout:directory}/parts/google_appengine/lib/ipaddr
${buildout:directory}/parts/google_appengine/lib/webob_1_1_1
${buildout:directory}/parts/google_appengine/lib/webapp2/
${buildout:directory}/parts/google_appengine/lib/yaml/lib
interpreter = python
[zipsymlink]
recipe = svetlyak40wt.recipe.symlinks
path = ${app:src}
files = ${app:app-directory}/packages.zip
# Tools and dependencies
svetlyak40wt.recipe.symlinks = 0.2.1
我的 app.yaml:
application: gaeapp
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /_ah/spi/.*
script: gae_api.APPLICATION
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
- name: setuptools
version: latest
- name: webob
version: latest
- name: webapp2
version: latest
builtins:
- deferred: on
我的 setup.py:
from setuptools import setup, find_packages
setup(
name = "gaeapp",
version = "1.0",
url = 'http://github.com/blabla/gaeapp',
license = 'BSD',
description = "Just a test GAE app.",
author = 'WOW',
packages = find_packages('src'),
package_dir = {'': 'src'},
install_requires = ['setuptools', 'pudb']
)
一切都安装得很好,nosetests 和 devappserver 都可以正常工作。运行服务器:
bin/devappserver parts/app
我正在尝试在代码中使用 pudb:
import pudb; pudb.set_trace();
只看到这样的错误:
ImportError: No module named pudb
有什么方法可以将 pudb 与 GAE 应用程序一起使用?