title: flask app fails when loaded with wsgi, but works fine with dev server
body: <p>I have my flask app working just great with the dev server when I run it like this:</p>
  
  <pre><code>python manage.py runserver
  </code></pre>
  
  <p>But when I try to run it with wsgi I get all kinds of "module not installed" errors, and even syntax errors.  Strangely, it shows a different error each time I hit an app route.</p>
  
  <p>on some of the errors, from the output in the apache error log, I can see that it's trying to run 2.7 versions of packages, when I am using 3.4.</p>
  
  <pre><code>File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 55, in &lt;module&gt;
  </code></pre>
  
  <p>I don't know why this is, python 3 is the default on the server and </p>
  
  <pre><code>$ python --version
  Python 3.4.2
  </code></pre>
  
  <p>is the output for every user on the system.  I <em>am</em> using virtualenv, but I did follow these instructions for setting up mod_wsgi with virtualenv: <a href="http://flask.pocoo.org/docs/0.11/deploying/mod_wsgi/" rel="nofollow noreferrer">http://flask.pocoo.org/docs/0.11/deploying/mod_wsgi/</a></p>
  
  <p>my wsgi file looks like this:</p>
  
  <pre><code>import sys
  
  activate_this = '/home/flask-dev/es_app/venv/bin/activate_this.py'
  with open(activate_this) as file_:
      exec(file_.read(), dict(__file__=activate_this))
  
  print(sys.path)
  
  from searchapp import app as application
  </code></pre>
  
  <p>and that print(sys.path) outputs this when I run it like 'python run.wsgi':</p>
  
  <pre><code>['/home/flask-dev/es_app/venv/lib/python3.4/site-packages', '/home/flask-dev/es_app', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/lib/python3/dist-packages']
  </code></pre>
  
  <p>i.e. a path to the 2.7 packages is nowhere in sight.  Also, all the required modules <em>are</em> installed in my virtualenv, which is why it works fine when I run the dev server.</p>
  
  <p>Totally stumped on this.  Any help appreciated.</p>