title: Execute a wsgi app from within another wsgi app via request method and store the html data
body: <p>The idea behind my code is to add a counter at the end of data of each html file and wsgi_mod file running:
  Counter is just adding that value bases on previous calculations.
  The problem is that every time i try to load </p>
  
  <pre><code>superhost.gr/clientele 
  or
  superhost.gr/download
  </code></pre>
  
  <p>which i already have in httpd.conf an open mod_wsgi process for those 2 python apps
  So every time app.py tries via request object to get the response of another wsgi app its keeps waiting and waiting for a long time until i ctrl-c</p>
  
  <p>How will i be able to open via request method a wsgi app and return it in the form of html data?</p>
  
  <p>=======================================================</p>
  
  <pre><code>@app.route( '/' )
  @app.route( '/&lt;page&gt;' )
  def index( page='index.html' ):
  
      # read environment
      pdata = ''
  
      if page == 'index.html' or page in ('clientele', 'downloads'):
          init()
          database( page )
  
      cur.execute( '''SELECT hits FROM pages WHERE url = %s''', page )
      pagehit = cur.fetchone()[0]
  
      # pick random line from the quote text file &amp; random mp3 from the the music folder
      quote = random.choice( list( open( '/home/nikos/public_html/data/private/quotes.txt', encoding='utf-8' ) ) )
      music = random.choice( os.listdir( '/home/nikos/wsgi/static/mp3/' ) )
  
  
      # add counter to html template and start rendering
      counter = '''&lt;table bgcolor=black    bordercolor=orangered&gt;
                      &lt;td&gt;&lt;font size=3 color=lime&gt; Αριθμός Επισκεπτών: &lt;/font&gt;&lt;/td&gt;   &lt;td&gt;&lt;a href="%s"&gt;&lt;font size=3 color=plum&gt; %s &lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
                  &lt;/table&gt;
              ''' % ( url_for('log', page=page), pagehit )
  
  
      if page in ('clientele', 'downloads'):
          try:
              r = requests.get( 'http://superhost.gr/' + page )
  
              if r.ok:
                  pdata = r.text + counter
          except Exception:
              sys.exit(0)
  
      elif page.endswith( '.html' ):
          pdata = render_template( page, quote=quote, music=music, page=page, pagehit=pagehit ) + counter
  
  
      return pdata
  </code></pre>