title: How to pass python variable to html variable?
body: <p>I need to read a url link from text file in python as a variable, and use it in html.
  The text file "file.txt" contains only one line "<a href="http://188.xxx.xxx.xx:8878" rel="nofollow">http://188.xxx.xxx.xx:8878</a>", this line should be saved in the variable "link", then I should use the contain of this variable in the html, so that the link should be opened when I click on the button image "go_online.png". I tried to change my code as following but it doesn't  work! any help please?</p>
  
  <pre><code>#!/usr/bin/python
  import cherrypy
  import os.path
  from auth import AuthController, require, member_of, name_is
  class Server(object):
      _cp_config = {
          'tools.sessions.on': True,
          'tools.auth.on': True
      }   
      auth = AuthController()      
      @cherrypy.expose
      @require()
      def index(self):
          f = open ("file.txt","r")
          link = f.read()
          print link
          f.close()
          html = """
          &lt;html&gt;
          &lt;script language="javascript" type="text/javascript"&gt;
             var var_link = '{{ link }}';
          &lt;/script&gt; 
            &lt;body&gt;
              &lt;p&gt;{htmlText} 
              &lt;p&gt;          
              &lt;a href={{ var_link }} &gt;&lt;img src="images/go_online.png"&gt;&lt;/a&gt;
            &lt;/body&gt;
          &lt;/html&gt; 
             """
  
          myText = ''           
          myText = "Hellow World"          
          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>