繁体   English   中英

链接问题将应用程序引擎的Shell应用程序嵌入我自己的应用程序中,以进行帮助编码

[英]Issue with links Embedding the app engine's shell app within my own app, for help coding

在我自己的App Engine应用程序中,在浏览器中,我想通过嵌入此应用程序-> http://shell.appspot.com/来模拟在浏览器窗口中对python解释器>>的访问,从而弄乱新代码。 。

可以通过http://code.google.com/p/google-app-engine-samples/downloads/detail?name=shell_20091112.tar.gz&can=2&q=获得shell_20091112.tar.gz

因此,我将密钥文件和文件夹从Shell应用程序移到了自己的应用程序目录中。 从SDK启动应用程序时,我可以在浏览器中看到位于

http://dwms.appspot.com/shell

在我的应用程序中,但是在我写完>>a=1 ...之后点击“ enter”……然后什么也没有发生,那么假设我的处理程序从表单到应用程序的链接是错误的吗? (对不起,如果我输入的术语不正确)。

我应该从中接收信息的表单在shell.html ,如下所示:

<form id="form" action="shell.do" method="get">
  <nobr>
  <textarea class="prompt" id="caret" readonly="readonly" rows="4"
            onfocus="document.getElementById('statement').focus()"
            >&gt;&gt;&gt;</textarea>
  <textarea class="prompt" name="statement" id="statement" rows="4"
            onkeypress="return shell.onPromptKeyPress(event);"></textarea>
  </nobr>
  <input type="hidden" name="session" value="{{ session }}" />
  <input type="submit" style="display: none" />
</form>

所以我在想问题是,由于我所做的更改或未进行的更改或做出的更改不正确,服务器从客户端获取'shell.do'时我的应用程序没有响应。

在我从网络上复制到应用程序目录的旧shell.py中,我注释掉了main()函数中的所有行:

#def main():
  #application = webapp.WSGIApplication(
    #[('/shell', FrontPageHandler),
     #('/shell/shell.do', StatementHandler)], debug=_DEBUG)
  #wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
  #main()

并通过将类似的链接添加到我自己的main.py来替换链接或管道信息,如下所示:

application = webapp.WSGIApplication(
                                     [('/', MainPage),
          ('/shell',shell.FrontPageHandler),
                                      ('shell.do', shell.StatementHandler),
                                      ('/sign', Guestbook),
          ('/zxy/.*', PNGserver) ],
                                     debug=True)


def main():
    run_wsgi_app(application)



if __name__ == "__main__":
    main()

再次-所以现在的问题是当我转到

http://dwms.appspot.com/shell

和类型

>> a=10

但在>>a=10之后在窗体中输入语句后什么也没发生

如果它是相关的...在下面,您会注意到我也注释了一些我从旧Shell的应用程序处理程序app.yaml复制到我的应用程序的app.yaml的行。.注:在尝试通过注释掉以下行之后它对外壳程序在我的应用程序中的工作方式没有影响...以下注释的原因是,我认为外壳程序可能需要用它来了解整个应用程序中所有全局变量的运行情况,而不是外壳在哪里运行? (我可能对此感到困惑?)

我的app.yaml如下:

application: dwms
version: 1
runtime: python
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

- url: /.*
  script: main.py

- url: /static
  static_dir: static
  expiration: 1d

- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py

# if you're adding the shell to your own app, change this regex url to the URL
# endpoint where you want the shell to run, e.g. /shell . You'll also probably
# want to add login: admin to restrict to admins only.
#
#- url: /shell
#  script: shell.py

我自己的问题的答案是安装以下Shell控制台,非常简单,并且看起来非常有帮助:

http://con.appspot.com/console/help/about

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM