Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Ajax向Google App Engine中的本地文件发出GET请求_Python_Ajax_Google App Engine - Fatal编程技术网

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

Python 使用Ajax向Google App Engine中的本地文件发出GET请求,python,ajax,google-app-engine,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

我希望通过这个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 not found”。我还在本地尝试了“localhost:8080/test.py”,并在实际服务器上尝试了“”

当我尝试像“”这样的外部文件时,会得到响应,但我无法从本地文件中获取任何内容

这是我的应用程序

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

感谢阅读

您需要在app.yaml中设置一个映射到test.py的处理程序。

您需要一个类似于

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

你在服务器端的代码是什么?我还没有写,但这不重要,因为客户端甚至看不到文件。如果你没有在服务器端(test.py)写代码,那么服务器怎么可能返回404以外的任何东西?如果您通常在appengine上编写test.py,那么实际上不会像那样映射url。Appengine不是老式的cgi。我告诉它打印一个字符串,但我没有输入我打算放在其中的代码。出于好奇,这个问题的哪一部分看起来不清楚、没用或缺乏研究?这是否足够“-url:/python script:test.app”?是的,只要将ajax调用中的url更改为“/python?一些变量…”