title: See anything wrong with my attempt to get Flask running? (mod_wsgi + virtualenv)
body: <p>I have a VPS running a fresh install of Ubuntu 10.04 LTS. I'm trying to set up a live application using the Flask microframework, but it's giving me trouble. I took notes while I tried to get it running and here's my play-by-play in an effort to pinpoint exactly where I went wrong.</p>
  
  <h1>INSTALLATION</h1>
  
  <p><a href="http://flask.pocoo.org/docs/installation/#installation" rel="nofollow noreferrer">http://flask.pocoo.org/docs/installation/#installation</a></p>
  
  <pre><code>$ adduser myapp
  $ sudo apt-get install python-setuptools
  $ sudo easy_install pip
  $ sudo pip install virtualenv
  
  /home/myapp/
  -- www/
  
  $ sudo pip install virtualenv
  
  /home/myapp/
  -- www/
  -- env/
  
  $ . env/bin/activate
  $ easy_install Flask
  </code></pre>
  
  <h1>MOD_WSGI</h1>
  
  <p><a href="http://flask.pocoo.org/docs/deploying/mod_wsgi/" rel="nofollow noreferrer">http://flask.pocoo.org/docs/deploying/mod_wsgi/</a></p>
  
  <pre><code>$ sudo apt-get install apache2
  $ sudo apt-get install libapache2-mod-wsgi
  </code></pre>
  
  <h1>Creating WSGI file</h1>
  
  <pre><code>$ nano /home/myapp/www/myapp.wsgi
  
  --myapp.wsgi contents:--------------------------
  activate_this = '/home/myapp/env/bin/activate_this.py'
  execfile(activate_this, dict(__file__=activate_this))
  from myapp import app as application
  
  /home/myapp/
  -- www/
       -- myapp.wsgi
  -- env/
  </code></pre>
  
  <h1>Configuring Apache</h1>
  
  <pre><code>$ nano /etc/apache2/sites-available/myapp.com
  
  -----myapp.com file contents ---------------------
  &lt;VirtualHost *:80&gt;
      ServerName myapp.com
  
      WSGIDaemonProcess myapp user=myapp group=myapp threads=5 python-path=/home/myapp/env/lib/python2.6/site-packages
  
      WSGIScriptAlias / /home/myapp/www/myapp.wsgi
  
      &lt;Directory /home/myapp/www&gt;
          WSGIProcessGroup myapp
          WSGIApplicationGroup %{GLOBAL}
          Order deny,allow
          Allow from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <h1>Enable the virtual host file I just created</h1>
  
  <pre><code>$ cd /etc/apache2/sites-enabled
  $ ln -s ../sites-available/myapp.com
  </code></pre>
  
  <h1>Restart Apache</h1>
  
  <pre><code>$ /etc/init.d/apache2 restart
  </code></pre>
  
  <p>Servers me a 500 server error page. Here's the latest error log:</p>
  
  <pre><code>mod_wsgi (pid=3514): Target WSGI script '/home/myapp/www/myapp.wsgi' cannot be loaded as Python module.
  mod_wsgi (pid=3514): Exception occurred processing WSGI script '/home/myapp/www/myapp.wsgi'.
  Traceback (most recent call last):
  File "/home/myapp/www/myapp.wsgi", line 4, in &lt;module&gt;
  from myapp import app as application
  ImportError: No module named myapp
  </code></pre>
  
  <p>The errors allude that it's something strikingly obvious, but I'm quite lost. </p>