Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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 appengine:在本地运行时,去掉多余的行(状态:200内容类型:application/json;等等)_Python_Google App Engine - Fatal编程技术网

Python appengine:在本地运行时,去掉多余的行(状态:200内容类型:application/json;等等)

Python appengine:在本地运行时,去掉多余的行(状态:200内容类型:application/json;等等),python,google-app-engine,Python,Google App Engine,我有两个返回纯JSON的应用程序引擎URL,这在生产中运行良好。但是,当我在本地运行应用程序(dev_appserver.py)时,它会在响应中在实际的json字符串之前吐出一些额外的行,如下所示: Status: 200 content-type: application/json; charset=utf-8 Cache-Control: no-cache Content-Length: 103480 [{"json":"here"}] 实际json之前的行导致我的javascript客

我有两个返回纯JSON的应用程序引擎URL,这在生产中运行良好。但是,当我在本地运行应用程序(dev_appserver.py)时,它会在响应中在实际的json字符串之前吐出一些额外的行,如下所示:

Status: 200
content-type: application/json; charset=utf-8
Cache-Control: no-cache
Content-Length: 103480

[{"json":"here"}]
实际json之前的行导致我的javascript客户端阻塞,有没有办法防止dev_appserver包含这些行

编辑:根据要求,处理程序如下:

class GetEvents(webapp2.RequestHandler):
    """
    returns json object with events for a given date (yyyy-mm-dd format)
    """
    def get(self):
        start_date = self.request.get("start") 
        use_cache = self.request.get("use_cache")
        # check if we have this date in cache
        output = memcache.get(start_date)
        if output == None or use_cache == "no": 
            # query datastore
            # make dictionary
            # store in cache 
        self.response.headers['Content-Type'] = "application/json"
        return self.response.out.write(output)
干杯

霍夫函数

好的,算出:
在处理程序中的某个地方,我有一个print语句,它似乎会导致显示这些额外的行。请留下此处作为参考。

请粘贴处理程序的代码(至少是相关部分)是的。永远不要在WSGI应用程序中使用
print