2014-12-26 2 views
1

토네이도의 StaticFileHandler 클래스를 사용하는 동안 다음과 같은 추적을 받고 있습니다. 역 추적은 :토네이도의 StaticFileHandler 클래스를 사용하는 동안 HTTP 404

서버/

  • httpserver.py
  • 정적/정적/foo는/바/files.extension
:

Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1334, in _execute 
    result = yield result 
    File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 628, in run 
    value = future.result() 
    File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 109, in result 
    raise_exc_info(self._exc_info) 
    File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 175, in wrapper 
    yielded = next(result) 
    File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 2110, in get 
    self.root, absolute_path) 
    File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 2286, in validate_absolute_path 
    raise HTTPError(404) 
HTTPError: HTTP 404: Not Found 

이 내 디렉토리의 구조

httpserver.py의 콘텐츠 :

settings = { 
'debug': True, 
'autoreload': True, 
} 

application = tornado.web.Application([\ 
      (r"/(.*)",tornado.web.StaticFileHandler,\ 
      {"path":"static/static/foo/bar/"}),],\ 
      **settings) 
application.listen(8888) 
tornado.ioloop.IOLoop.instance().start() 

비슷한 질문을했지만 나에게 적절한 해결책을 제공하지 않는 것 같습니다.

+0

당신이 가져올 때 때문에'는 파일과 충돌한다 httpserver''httpserver.py' – Abdelouahab

답변

0

이 문제는 혼자 해결되었습니다. 나는 키워드 매개 변수 static_path를 추가했다.이 경로는 루트에서 .py 파일이있는 디렉토리까지의 경로이다. 수정 된, 작업 코드 :

settings = { 
'debug': True, 
'autoreload': True, 
'static_path': '/home/path/to/pythonFile' 
} 

application = tornado.web.Application([\ 

      (r"(.*)",tornado.web.StaticFileHandler,\ 
      {"path":"static/foo/bar"}),],\ 
      **settings) 
application.listen(8888) 
tornado.ioloop.IOLoop.instance().start() 
+0

어떤 파일 평? 나는이 정확한 추적을하고있다. –

+1

httpserver.py 파일 – Sentient07

관련 문제