I'm using CherryPy with Python, and I'm quite new to it all. Eventually I will be using JQuery too, so following an example online, I have the below, which is calling the html correctly.
My issue is, that although it's calling my html, I am not sure what to do with my CSS and images that I have with it. I've tried calling them as normal from the html, but I have not had any luck.
def index(self):
return file('index.html')
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd())
},
'/generator': {
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
'tools.response_headers.on': True,
'tools.response_headers.headers': [('Content-Type', 'text/plain')],
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './public'
}
}
webapp = StringGenerator()
webapp.generator = StringGeneratorWebService()
cherrypy.quickstart(webapp, '/', conf)
within my html I have the normal <link href="/static/css/style2.css" rel="stylesheet"> but it isn't working.
My file structure is - with public and css being a folder:
fitbit.py fitbit.html - public - css style2.css
So it's calling the fitbit.html correctly, but within the html, I cannot get the css and image. Any help as to how to call it would be greatly appreciated.