title: Hello World - Flask / Apache / mod_wsgi - no response from Apache
body: <p>I am following the tutorial at <a href="http://www.enigmeta.com/2012/08/16/starting-flask/">http://www.enigmeta.com/2012/08/16/starting-flask/</a> to develop and deploy a simple flask app to Apache using mod_wsgi. I think I've narrowed it to a flaw in my Apache config. If I run helloflask.py from the command line, it works fine. I can access it via wget from another shell at localhost:5000, and I get the correct response. I also have other virtual hosts (non wsgi) up and running, so I know Apache is running and responding to other requests on port 80.</p>
  
  <p>I have the following structure:</p>
  
  <pre><code>/sites/helloflask.mydomain.com
     /helloflask
        application.wsgi
        helloflask.py
        (rest of env from virtualenv)
     /log
        access.log
        error.log
  </code></pre>
  
  <p>helloflask.py:</p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route("/")
  def hello():
      return "Hello World!"
  
  if __name__ == "__main__":
      app.run()
  </code></pre>
  
  <p>application.wsgi:</p>
  
  <pre><code>import os, sys, logging
  logging.basicConfig(stream=sys.stderr)
  
  PROJECT_DIR = '/sites/helloflask.mydomain.com/helloflask'
  
  activate_this = os.path.join(PROJECT_DIR, 'bin', 'activate_this.py')
  execfile(activate_this, dict(__file__=activate_this))
  sys.path.append(PROJECT_DIR)
  
  from helloflask import app as application
  </code></pre>
  
  <p>Apache config:
  /etc/apache2/sites-available/helloflask.mydomain.com</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName helloflask.mydomain.com
  
    WSGIDaemonProcess helloflask user=myuser group=myuser threads=5
    WSGIScriptAlias / /sites/helloflask.mydomain.com/helloflask/application.wsgi
  
    &lt;Directory /sites/helloflask.mydomain.com/helloflask&gt;
      WSGIProcessGroup helloflask
      WSGIApplicationGroup %{GLOBAL}
      Order deny,allow
      Allow from all
    &lt;/Directory&gt;
    LogLevel warn
    ErrorLog /sites/helloflask.mydomain.com/log/error.log
    CustomLog /sites/helloflask.mydomain.com/log/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I enable the vhost, restart apache, and get no response from the browser. "Server not found", so no 500 response, nothing. No entries in the access / error logs (specific to this vhost). I do get the following in the overarching Apache error log each time I restart:</p>
  
  <pre><code>[Sat Jun 29 20:07:58 2013] [notice] caught SIGTERM, shutting down
  [Sat Jun 29 20:07:59 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
  [Sat Jun 29 20:07:59 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
  [Sat Jun 29 20:07:59 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
  </code></pre>
  
  <p>I'm wondering if those two [warn] lines indicating different versions of Python are my problem, but I don't know how or what to modify to fix it. Any suggestions are appreciated.</p>
  
  <p>Thanks!</p>