title: How to automatically reload a web page when having a certain variable's value?
body: <p>In the following python/html script,I want to refresh the web page automatically when the value of the variable "condition" equal to "1". So that the page show me the new text contains of the variable "myText" automatically. The variable "myText" can have any text, and the following script is just an example.</p>
  
  <pre><code>#!/usr/bin/python
  import cherrypy
  import os.path
  import struct
  from auth import AuthController, require, member_of, name_is
  import subprocess
  import commands
  
  class Server(object):
      led_logout=0 
      led_restart=0
      condition=0
      _cp_config = {
      'tools.sessions.on': True,
      'tools.auth.on': True
      }   
      auth = AuthController()      
      @cherrypy.expose
      @require()
      def index(self,logout=''):
  
      html = """
       &lt;html&gt;
        &lt;head&gt;
        &lt;/head&gt;
            &lt;body&gt;
          &lt;p&gt;{htmlText} 
          &lt;p&gt;
              &lt;a href="?logout=1" onclick="return confirm('Are you sure you want to logout?');"&gt;&lt;img src="images/Logout.png"&gt;&lt;/a&gt;
          &lt;/ul&gt;
            &lt;/body&gt;
       &lt;/html&gt;    
             """
      myText = ''
      myText = "Hello"
      if logout:
          self.led_logout = int(logout)             
      if self.led_logout:
          print "Logout !!!!!"
          AuthController().logout('/?logout=0')         
      return html.format(htmlText=myText)      
      index.exposed = True
  #configuration
  conf = {
      'global' : { 
          'server.socket_host': '0.0.0.0', #0.0.0.0 or specific IP
          'server.socket_port': 8085 #server port
      },
  
      '/images': { #images served as static files
          'tools.staticdir.on': True,
          'tools.staticdir.dir': os.path.abspath('/home/ubuntu/webserver/images')
      }
      }
  cherrypy.quickstart(Server(), config=conf)
  </code></pre>