web.py:通过 iFrame 加载多个 html 文件时出错

web.py : Error loading multiple html files via iFrames

我正在学习 web.py 并尝试一个应用程序,其中 web.py 需要加载一个 html 文件,其中 iframes 加载三个不同的 html 文件.

直接从 web-browser 启动时,index.html 文件可以正确加载并获得所需的结果,但是通过 app.py.

加载时会出现 not found 错误

目录结构如下:

appdir/  
      app.py  
      templates/  
               index.html
               frames_top.html
               frames_left.html
               frames_right.html

这里是index.html

的内容
<html>
<head>
<title>Example - Frames</title>
</head>
<iframe name="top_frame" src="frames_top.html" width="100%" height="100"> scrolling="no" align="top" </iframe> 

<iframe name="left_frame" style="border-style: none; border-color: inherit; border-width: 10px; height:1222px; width:10%;" src="frames_left.html" target="right_frame" scrolling="no" align="left" >
</iframe>

<iframe name="right_frame" style="border-style: none; border-color: inherit; border-width: 10px; height:1222px; width:90%;" src="frames_right.html" target="right_frame" scrolling="no" align="middle" >
</iframe> 
</html>

这里是 app.py

的内容
import web

""" url definition""" 
urls = (
  '^/$', 'do_index_frame',
  '^/$', 'do_left_frame',
  '^/$', 'do_right_frame',
  '^/$', 'do_top_frame'
)


app = web.application(urls, globals())

render = web.template.render('templates/')

class do_index_frame:
    def GET(self):
        return render.index()

class do_left_frame:    
    def GET(self):
        return render.frames_left()

class do_right_frame:    
    def GET(self):
        return render.frames_right()

class do_top_frame:    
    def GET(self):   
        return render.frames_top()


if __name__ == "__main__":
    app.run()

当我 运行 app.py 并在 127.0.0.1:8080 启动浏览器时,
我得到以下屏幕

有这个错误:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
http://0.0.0.0:8080/
127.0.0.1:56483 - - [25/May/2016 15:00:06] "HTTP/1.1 GET /" - 200 OK
127.0.0.1:56483 - - [25/May/2016 15:00:07] "HTTP/1.1 GET /frames_top.html" - 404 Not Found127.0.0.1:56482 - - [25/May/2016 15:00:07] "HTTP/1.1 GET /frames_left.html" - 404 Not Found

127.0.0.1:56493 - - [25/May/2016 15:00:07] "HTTP/1.1 GET /frames_right.html" - 404 Not Found
127.0.0.1:58680 - - [25/May/2016 15:13:25] "HTTP/1.1 GET /" - 200 OK
127.0.0.1:58680 - - [25/May/2016 15:13:25] "HTTP/1.1 GET /frames_top.html" - 404 Not Found
127.0.0.1:58682 - - [25/May/2016 15:13:25] "HTTP/1.1 GET /frames_left.html" - 404 Not Found
 127.0.0.1:58681 - - [25/May/2016 15:13:25] "HTTP/1.1 GET /frames_right.html" - 404 Not Found

有人能确定错误的原因吗?

在浏览 web.py 文档后,我需要做的就是提供文件名和 html 文件的完整路径,以便通过 urls.[= 访问它们14=]

我想我会 post 在这里以防其他人遇到类似问题。

""" url definition""" 
urls = (
  '/path/to/files/index.html', 'do_index_frame',
  '/path/to/files/left.html', 'do_left_frame',
  '/path/to/files/right.html', 'do_right_frame',
  '/path/to/files/top.html', 'do_top_frame'
)