I tried for about 5 hours now to display a image to my webpage. My code is like this:
import os
import cherrypy
file_path = os.getcwd().replace("\\", "/")
class Home:
def index(self):
return """<img src="img/logolong.jpg" alt="Main Page" />"""
index.exposed = True
if __name__ == "__main__":
cherrypy.server.socket_host = "127.0.0.1"
cherrypy.server.socket_port = 50505
config = {"/static":
{"tools.staticdir.on": True,
"tools.staticdir.dir": file_path,
},
"/images":
{"tools.staticdir.on": True,
"tools.staticdir.dir": file_path+"/img"}
}
cherrypy.tree.mount(Home(), "/", config=config)
cherrypy.engine.start()
cherrypy.engine.block()
I searched everywhere and tried like everything. I'm using Google Chrome and Windows7.
Thanks a lot for help!