本地运行 Tornado 文档

发布于 2024-12-08 17:49:41 字数 1521 浏览 2 评论 0原文

本周我正在使用 Facebook 的 Tornado 框架,有时我会进入互联网不稳定的地区。由于 网站 位于存储库中,如何让它在本地运行?是在AppEngine下吗?

我第一次运行它时,我没有查看内部,所以我只是做了,

python website.py

然后给出了以下内容,

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/wsgiref/handlers.py", line 93, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/phwd/tornado/website/tornado/wsgi.py", line 90, in __call__
    handler = web.Application.__call__(self, HTTPRequest(environ))
  File "/Users/phwd/tornado/website/tornado/wsgi.py", line 107, in __init__
    self.method = environ["REQUEST_METHOD"]
KeyError: 'REQUEST_METHOD'
Status: 500 Dude, this is whack!
Content-Type: text/plain
Content-Length: 59

哦,好吧,所以它正在使用 wsgi.py?我尝试从 Google App Engine 调用它,

 dev_appserver.py .

它启动了第一页,但是当我查看主要文档时,

ERROR    2011-10-07 17:26:59,566 dev_appserver.py:3360] Error encountered reading file "/Users/phwd/tornado/website/sphinx/build/html/index.html":
[Errno 2] No such file or directory: '/Users/phwd/tornado/website/sphinx/build/html/index.html'
INFO     2011-10-07 17:26:59,574 dev_appserver.py:4247] "GET /documentation/index.html HTTP/1.1" 404

我是否需要使用 Sphinx 做一些事情才能使该文档在 Tornado Web 服务器下本地工作?那里有一个conf.py文件,那么它不是已经设置了吗?

如何运行网站应用程序以及使用它需要哪些必要的依赖项?

I am using Facebook's Tornado Framework this week and I am sometimes in areas where the internet is spotty. Since the website is in the repo, how do I get it to run locally? Is it under AppEngine?

The first time I ran it I didn't look inside so I just did,

python website.py

And well that gave the following,

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/wsgiref/handlers.py", line 93, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/phwd/tornado/website/tornado/wsgi.py", line 90, in __call__
    handler = web.Application.__call__(self, HTTPRequest(environ))
  File "/Users/phwd/tornado/website/tornado/wsgi.py", line 107, in __init__
    self.method = environ["REQUEST_METHOD"]
KeyError: 'REQUEST_METHOD'
Status: 500 Dude, this is whack!
Content-Type: text/plain
Content-Length: 59

Oh okay, so it is using wsgi.py? I tried calling it from Google App Engine instead,

 dev_appserver.py .

It started the first page but as soon as I peeked into the main documentation

ERROR    2011-10-07 17:26:59,566 dev_appserver.py:3360] Error encountered reading file "/Users/phwd/tornado/website/sphinx/build/html/index.html":
[Errno 2] No such file or directory: '/Users/phwd/tornado/website/sphinx/build/html/index.html'
INFO     2011-10-07 17:26:59,574 dev_appserver.py:4247] "GET /documentation/index.html HTTP/1.1" 404

Is there something I need to be doing with Sphinx to get this documentation working locally under a Tornado Web Server? There is a conf.py file in there so isn't it already setup?

How to run the website app and what are the necessary dependencies I need to use it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

攒眉千度 2024-12-15 17:49:41

在某些代码中使用了 wsgiref.handlers.CGIHandler().run(app) ,那么我们就会遇到这个问题,
替换为下面的代码,它可能会起作用。

from wsgiref.simple_server import make_server
app = tornado.wsgi.WSGIApplication(
     ...
      )
httpd = make_server('',8000,app)
httpd.serve_forever()

in some code wsgiref.handlers.CGIHandler().run(app) is used, then we will have this issue,
replace by code below,it may work.

from wsgiref.simple_server import make_server
app = tornado.wsgi.WSGIApplication(
     ...
      )
httpd = make_server('',8000,app)
httpd.serve_forever()
回忆那么伤 2024-12-15 17:49:41

该存储库不包含文档的内置 HTML。在“tornado/website/”目录中运行make

另外,请确保您已安装 mysqldb。

(不过,为什么 Web 服务器的文档要求您运行另一个性能明显更差的 Web 服务器来阅读它,这超出了我的理解范围。)

The repo doesn't include the built HTML for the documentation. Run make in the "tornado/website/" directory.

Also, make sure you have mysqldb installed.

(Why the documentation for a web server requires you to run another, significantly worse web server to read it is beyond me, though.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文