I am using cherryPy to create a simple python web app. I plan on having a few pages with most likely identical header / footer. How can I include or merge header / footer with for example index.html static page?
Right now I am able to have the whole static page returned or dynamic content:
return open('index.html')
#or
return("dynamic content")
In PHP you would simply include it but in python / cherrypy there does not seem to be a simple way of achieving this. Perhaps my idea of how cherrypy works is wrong. I could go with html generated by cherrypy but I don't like the fact that I would be dealing with escaping issues just for static html, not to mention the lack of proper syntax highlighting etc...
What is a good way to have a common header and footer with cherrypy?
from cherrypy docs
CherryPy does not provide a built-in support for database access, HTML templating or any other middleware nifty features.
so you would need to either create your own content serve function that includes your header and footer, or use javascript to load the header/footer, or download a 3rd party library that provides html templating (like JINJA), or switch to something like flask that already has a templating engine