开发者

Running Tornado Documentation locally

I am using Faceb开发者_如何学JAVAook'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?


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()


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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜