使用Ajax向Google App Engine中的本地文件发出GET请求

时间:2013-07-29 05:43:52

标签: python ajax google-app-engine

我想通过此Ajax调用在我的Google App Engine应用程序上使用Python文件运行功能服务器端。

function test(){
  request = $.ajax({
    url: "test.py?some_vars...",
    type: "get",
  });
  request.done(function (response, textStatus, jqXHR){
    console.log(response);
  });
}

当我运行test()时,控制台会记录404错误,“找不到test.py”。我还在本地尝试了“localhost:8080 / test.py”,在实际服务器上尝试了“http://APP.appspot.com/test.py”。

当我尝试像“http://graph.facebook.com/steve”这样的外部文件时,我收到了回复,但我无法从本地文件中获取任何内容。

这是我的app.yaml

application: APP
version: 1
runtime: python27
threadsafe: true
api_version: 1

handlers:

- url: /images
  static_dir: images 

- url: /js
  static_dir: js

- url: /css
  static_dir: css

- url: /.*
  script: apprtc.app
  secure: always

- url: /python
  script: test.app

inbound_services:
- channel_presence

libraries:
- name: jinja2
  version: latest

感谢您阅读

2 个答案:

答案 0 :(得分:1)

您需要在app.yaml中设置一个映射到test.py。

的处理程序

答案 1 :(得分:0)

你需要一条看起来像......的路线。

- url: /test.py
  script: test.app