doubts on cherrypy

85 views
Skip to first unread message

ram_ganeshu

unread,
May 14, 2012, 4:05:38 AM5/14/12
to cherrypy-users
Hi...all,
I am using cherrypy more than 2 months, now i am having strange
doubt, is it necessary we should use def index(), for our index
page....(exact name index(), we can't use other names?)?
One more is i want to call
directly a html file, that is navigation from one html file to another
html file, is it possible?(i want to call a static html file, from my
another html file) instead of writing a method to call a static
file...
please help me to find out....Thanks in
advance.....

eugene.va...@gmail.com

unread,
May 14, 2012, 4:19:22 AM5/14/12
to cherryp...@googlegroups.com
You could use serve_file in index to return a html file and the staticdir tool for all other html files you want to link to.

EuGeNe -- follow me on http://twitter.com/3kwa
> --
> You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
> To post to this group, send email to cherryp...@googlegroups.com.
> To unsubscribe from this group, send email to cherrypy-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en.
>

Tim Roberts

unread,
May 14, 2012, 2:19:08 PM5/14/12
to cherryp...@googlegroups.com
ram_ganeshu wrote:
> I am using cherrypy more than 2 months, now i am having strange
> doubt, is it necessary we should use def index(), for our index
> page....(exact name index(), we can't use other names?)?

Why would you want to?

Here's the issue. Web requests need to end up with files, not
directories. When a web request arrives for a directory (like
"http://www.website.com/" or "http://www.website.com/folder/"), Apache
rewrites that to refer to "index.html". (The exact list is in your
Apache configuration files.) That's where this convention comes from.

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

GaneshPandi

unread,
May 15, 2012, 1:10:38 AM5/15/12
to cherryp...@googlegroups.com
why...in the sense, my doubt is that...so it is fixed? we have to to use index () only, for index page...

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherryp...@googlegroups.com.
To unsubscribe from this group, send email to cherrypy-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en.




--
---G.GaneshPandi---

Alan Pound

unread,
May 15, 2012, 5:05:11 AM5/15/12
to cherryp...@googlegroups.com
Not fixed - it never was broken.

As described, this business about "index.html" is a bit of pandering to an old convention.

You can of course use any name as an initial or subsequent landing page.

Alan
winmail.dat

Tim Roberts

unread,
May 15, 2012, 1:13:01 PM5/15/12
to cherryp...@googlegroups.com
GaneshPandi wrote:
> why...in the sense, my doubt is that...so it is fixed? we have to to
> use index () only, for index page...

I'm sorry, I don't understand the question.

"index" is just a convention. If you are using Apache as a front-end,
you can change the name of the default page using the DirectoryIndex
directive in your .htaccess file.

Also, remember that you aren't REQUIRED to support an index page. If
you know that every request to your CherryPy site will include a page
name, then you don't need index(). It all depends on what you need to
provide to your users.
Reply all
Reply to author
Forward
0 new messages