I want to make a some web page. but i can't load image files in the html. I don't know why this situation is happen. I attached HTML code, python tornado code. could you help me?
HTML FILE
<!DOCTYPE html>
<html>
<body>
<p>The GIF standard allows moving images.</p>
<img src="programming.gif" alt="Computer man" style="width:148px;hei ght:148px;">
</body>
</html>
PYTHON-TORNADO FILE
import tornado.web
import tornado.ioloop
import tornado.httpserver
class Handler(tornado.web.RequestHandler):
def get(self):
self.render("html_image_05.html")
application = tornado.web.Application([
(r"/",Handler)
])
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(80)
tornado.ioloop.IOLoop.instance().start()
and this is message code when i execute this code.
WARNING:tornado.access:404 GET /eh5v.files/html5video/test.jpg (127.0.0.1) 0.56ms
WARNING:tornado.access:404 GET /eh5v.files/html5video/html5ext.js (127.0.0.1) 0.41ms
WARNING:tornado.access:404 GET /eh5v.files/html5video/test.m4v (127.0.0.1) 0.48ms
WARNING:tornado.access:404 GET /eh5v.files/html5video/test.jpg (127.0.0.1) 0.34ms
WARNING:tornado.access:404 GET /eh5v.files/html5video/test.webm (127.0.0.1) 0.36ms
I'm solved the problem. that is way.
Python file code (Fixed)
import tornado.web
import tornado.ioloop
import tornado.httpserver
class Handler(tornado.web.RequestHandler):
def get(self):
self.render("html_image_05.html")
application = tornado.web.Application([
(r"/",Handler),
(r"/(programming.gif)", tornado.web.StaticFileHandler, {'path':'./'}) <--Add!
])
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(80)
tornado.ioloop.IOLoop.instance().start()
That's solution about connecting image with html and python file.