List Info

Thread: Using CherryPy locally and launching a browser




Using CherryPy locally and launching a browser
user name
2006-04-29 16:23:24
First of all, I would like to congratulate CherryPy
developpers.  It's
really user friendly.  I downloaded it last night and,
without any
prior web programming experience, I managed to get it to do
something
useful for me!

I am using CherryPy to create a kind of Python Console run
locally.
Although it is not required to answer my question, if you
want more
detail of what I mean by this, you can read
http://aroberge.blogspot.com/2006/04/cherrypy-is-grea
t.html
Eventually I intend to use this type of web-browser
environment as a
graphical front-end for "rur-ple".

As I start CherryPy, I want to start my browser
automatically.  I do
this (schematically) as follows:

=====
import webbrowser
import cherrypy

settings = {
 'global': {
    'server.socketPort' : 8080,
    'server.threadPool': 10,
    'server.environment': "production"
}
class PythonRunner(object):
    def index(self):
         return ''
    index.exposed = True

cherrypy.root = PythonRunner()
cherrypy.config.update({'session_filter.on': True})
webbrowser.open('http://localhost:8080/ind
ex')

if __name__ == '__main__':
    cherrypy.config.update(settings)
    cherrypy.server.start()
===========
If I don't have a webbrowser (read "Firefox")
running, it loads it up
just fine.
If Firefox is already running, then a new tab gets open
*but* I get an
error message as the connection is not established; to make
it work, I
have to reload the page.
I was wondering if there was a way to find out if the server
is running
properly before opening the webbrowser connection.  I'd
rather not put
an artificial time delay if I can avoid it.

André


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )