title: Hello World in mod_wsgi
body: <p>After failing repeatedly in my quest to get my flask application to run on Apache using <code>mod_wsgi</code> I decided to try running the <a href="http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide" rel="noreferrer">hello world example</a>. Here is what I have - </p>
  
  <p>Directory Structure (I changed the apache default <code>/var/www</code> to <code>~/public_html</code>)</p>
  
  <pre><code>- public_html    
     - wsgi-scripts
        - test_wsgi.wsgi
     - test_wsgi
        - test_wsgi.wsgi
  </code></pre>
  
  <p>test_wsgi.wsgi  file</p>
  
  <pre class="lang-py prettyprint-override"><code>def application(environ, start_response):
      status = '200 OK'
      output = 'Hello World!'
  
      response_headers = [('Content-type', 'text/plain'),
                          ('Content-Length', str(len(output)))]
  
      start_response(status, response_headers)
  
      return [output]
  </code></pre>
  
  <p>VirtualHost Configuration file (called testwsgi) - This resides in <code>/etc/apache2/sites-enabled/</code></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;VirtualHost *:80&gt;
      DocumentRoot ~/public_html/test_wsgi
  
      &lt;Directory ~/public_html/test_wsgi&gt;
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
  
      WSGIScriptAlias /wsgi ~/public_html/wsgi-scripts/test_wsgi.wsgi
  
      &lt;Directory ~/public_html/wsgi-scripts&gt;
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When I try going to <code>localhost/wsgi</code> on the browser I get a 404 Not Found error. What am I doing wrong? This is the first time I'm trying to deploy an app on a production server. Until now I took the easy way of using Google App Engine. I cant proceed to deploy my flask app until this is up and running. Thanks a lot!</p>