空白页面,但没有错误 - Python Appengine [英] Blank Page But No Error - Python Appengine

查看:164
本文介绍了空白页面,但没有错误 - Python Appengine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的appengine python网站上收到间歇性的空白页面。通常,这些是在启动新进程或刷新缓存时发生的。有一个单一的白页服务,一旦服务一切都很好。



基本上与此处错误相同:



http://groups.google.com/group/google -appengine / browse_thread / thread / c072383dc970e450



然而,我有双重和三重检查,我在我的Python文件上有正确的代码(复制下面的内容和粘贴):

  def main():
run_wsgi_app(应用程序)

if __name__ ==__main__:
main()

生成空白页的日志:


  01-02 04:46 AM 48.539 / 200 188ms 570cpu_ms 383api_cpu_ms 0kb 

Mozilla / 5.0(Windows; U; Windows NT
6.0; en-US) AppleWebKit / 534.13(KHTML,如Gecko)Chrome / 9.0.597.19
Safari / 534.13,gzip(gfe),gzip(gfe),gzip(gfe)
86.164.42.252 - tjcritchlow [02 / Jan / 2011:04:46:48 -0800]GET /
HTTP /1.1200 124 - Mozilla / 5.0
(Windows; U; Windows NT 6.0;
AppleWebKit / 534.13(KHTML,如Gecko)
Chrome / 9.0.597.19
Safari / 534.13,gzip(gfe),gzip(gfe),gzip(gfe)
www.7bks.comms = 188 cpu_ms = 570
api_cpu_ms = 383 cpm_usd = 0.016028
I 01-02 04:46 AM 48.724
保存;键: appstats :008500,部分:82个字节,全部:92081个字节,
开销:0.001 + 0.005;链接:
http://www.7bks.com/stats/details?time=1293972408543


任何建议欢迎我如何进一步调试或解决此问题。



我有几个不同的python文件,这里是我的应用程序的处理程序.yaml。但是我已经检查了所有这些以确保它们都在底部具有正确的 name 代码。

 处理程序:

- url:/admin/.*
脚本:admin.py
登录名:admin

- url :/ googleanalytics /
script:g oogleanalytics.py
登录名:admin
$ b $ - url:/ cleanupsessions /
脚本:cleanupsessions.py
登录名:admin

- url :/robots.txt
static_files:robots.txt
上传:robots.txt

- url:/favicon.ico
static_files:images / favicon.ico
upload:images / favicon.ico

- url:/ images
static_dir:images

- url:/ css
static_dir:css

- url:/ jquery
static_dir:jquery

- url:/.*
script:7books.py

error_handlers:
- file:customerror.html

问题是否可以与其中一个我正在导入的库?我是否应该检查所有这些以确保它们都具有名称代码?

解决方案

页面问题,调试可能有点牵扯,除非您可以将问题缩小到特定的代码片段或GAE堆栈。



Appstats是GAE (作为WSGI中间件)并记录性能,调试和其他来自请求的信息,并将它们聚合到一个管理界面中,您可以通过GAE管理站点访问这些界面。这是查看错误追踪的好方法,并监控您的网站是否存在错误(一旦您安装了appstats,它就会显示为请求列表中的黄色E行项目)。



首先,您应按照以下指示设置Appstats:

http://code.google.com/appengine/docs/python/tools/appstats.html



......它会告诉你大量关于每个
请求的有用信息,尤其是那些有错误的信息,包括一个Python traceback
,其中包含错误的地方以及调用堆栈中的地方就像您习惯于在本地使用Google App Engine启动器或Python CLI或iPython在代码中调试错误一样。

然后,下次您看到一个空白页面,跳转到您的管理页面或
到appstats,登录,并且您将有一个回溯,它会告诉您
代码中的哪些内容

最有可能的是,这只是过早返回的东西,或者是代码中的某个
未处理的边缘案例,但它可能仅仅是
很容易成为宇宙射线,直到您有appstats查看您的请求
日志并调试错误。



安装完Appstats并重现问题后,粘贴上面的回溯(请记住删除任何用户信息,例如可能在回溯中的密码),并且我会修改此回复以匹配。


I'm receiving intermittent blank pages on my appengine python website. Typically these come when a new process is started or when I flush the cache. There is a single white page served and once that has served everything is fine.

It's basically the same error as here:

http://groups.google.com/group/google-appengine/browse_thread/thread/c072383dc970e450

However, I have double and triple checked that I have the correct code on my python file (the following is copied and pasted):

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

Here is an example response in the logs that generated the blank page:

01-02 04:46AM 48.539 / 200 188ms 570cpu_ms 383api_cpu_ms 0kb

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.19 Safari/534.13,gzip(gfe),gzip(gfe),gzip(gfe) 86.164.42.252 - tjcritchlow [02/Jan/2011:04:46:48 -0800] "GET / HTTP/1.1" 200 124 - "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.19 Safari/534.13,gzip(gfe),gzip(gfe),gzip(gfe)" "www.7bks.com" ms=188 cpu_ms=570 api_cpu_ms=383 cpm_usd=0.016028 I 01-02 04:46AM 48.724 Saved; key: appstats:008500, part: 82 bytes, full: 92081 bytes, overhead: 0.001 + 0.005; link: http://www.7bks.com/stats/details?time=1293972408543

Any suggestions welcome on how I might debug further or solve this issue.

I have a couple of different python files, here's the handlers from my app.yaml. But I've checked all of them to ensure they all have the correct if name code at the bottom.

handlers:

- url: /admin/.*
  script: admin.py
  login: admin

- url: /googleanalytics/
  script: googleanalytics.py
  login: admin

- url: /cleanupsessions/
  script: cleanupsessions.py
  login: admin

- url: /robots.txt
  static_files: robots.txt
  upload: robots.txt

- url: /favicon.ico
  static_files: images/favicon.ico
  upload: images/favicon.ico

- url: /images
  static_dir: images

- url: /css
  static_dir: css

- url: /jquery
  static_dir: jquery

- url: /.*
  script: 7books.py

error_handlers:
  - file: customerror.html

Could the issue be with one of the libraries I'm importing? Should I check all of them to ensure they all have the name code?

解决方案

Regarding the blank page issue, debugging that might be a bit involved unless you can narrow down the problem to a particular piece of your code or the GAE stack.

Appstats is a tool for GAE that hooks into each web request (as WSGI middleware) and records performance, debugging, and some other information from requests, aggregating them in an administrative interface which you can access through your GAE admin site. It's a nice way of seeing tracebacks for errors, and monitoring your site for errors (which show up as yellow boxed "E" line items in the request listing once you've installed appstats).

First, you should set up Appstats by following the directions at:

http://code.google.com/appengine/docs/python/tools/appstats.html

...which will tell you loads of useful information about every request, especially ones with errors, including a Python traceback containing what went wrong and where in the call stack, just like you're used to when debugging errors with your code locally using the Google App Engine Launcher or even just Python CLI or iPython.

Then, next time you see a blank page, hop over to your admin page or to appstats, log in, and you'll have a traceback that will tell you where in your code something broke.

Most likely, this is just something returning prematurely or an unhandled edge case somewhere in your code, but it could just as easily be cosmic rays until you have appstats to look at your request logs and debug the error.

Once you've installed Appstats and reproduced the problem, paste the traceback above, (remember to remove any user information such as passwords that may be in the traceback), and I'll revise this response to match.

这篇关于空白页面,但没有错误 - Python Appengine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆