Re: [cherrypy-users] Newbie, How to return static html file instead of returning html code?

34 views
Skip to first unread message

Tim Roberts

unread,
Oct 16, 2012, 12:57:05 PM10/16/12
to cherryp...@googlegroups.com
Imax36581 wrote:
>
> in a simple application i want to return a html file rather than
> return <HTML Code>.
> assume i mean something like this:
> instead of
> return <body>hello world!</body>
> do something like
> return /my/path/index.html
>
It's just like any normal Python program:

return open('/my/path/index.html','r').read()


> the point is the html file use some css and .js files. how could i
> publish those files?

If those CSS and js files are reachable are using fully-qualified URLs,
then there's no problem. If they have relative URLs, then you'll need
to make sure they are reachable from your web server.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Reply all
Reply to author
Forward
0 new messages