title: SyntaxError with VirtualEnv + mod-wsgi in Django
body: <p>I am having trouble using <code>VirtualEnv</code> on my production <code>Ubuntu 13.04</code> server with <code>mod-wsgi</code>.</p>
  
  <p>Would someone be able to point out what the issue may be?</p>
  
  <p>Here is the traceback that I am getting the below syntax error:</p>
  
  <pre><code>[Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22] mod_wsgi (pid=14292): Target WSGI script '/home/aaron/public_html/flapsta.com/flapsta/flapsta/flapsta.wsgi' cannot be loaded as Python module.
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22] mod_wsgi (pid=14292): Exception occurred processing WSGI script '/home/aaron/public_html/flapsta.com/flapsta/flapsta/flapsta.wsgi'.
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22] Traceback (most recent call last):
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22]   File "/home/aaron/public_html/flapsta.com/flapsta/flapsta/flapsta.wsgi", line 16, in &lt;module&gt;
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22]     execfile(activate_env, dict(__file__=activate_env))
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22]   File "/home/.virtualenvs/flapsta/bin/activate", line 4
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22]     deactivate () {
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22]                   ^
  [Mon Jul 14 14:37:09 2014] [error] [client 70.180.246.22] SyntaxError: invalid syntax
  </code></pre>
  
  <p>I have my flapsta.wsgi file set up like so:</p>
  
  <pre><code>import os
  import sys
  import site
  
  # Add the site-packages of the chosen virtualenv to work with
  site.addsitedir('/home/.virtualenvs/flapsta/lib/python2.7/site-packages')
  
  # Add the app directories to the PYTHONPATH
  sys.path.append('/home/aaron/public_html/flapsta.com')
  sys.path.append('/home/aaron/public_html/flapsta.com/flapsta')
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'flapsta.settings'
  
  # Activate the virtualenv
  activate_env=os.path.expanduser('/home/.virtualenvs/flapsta/bin/activate')
  execfile(activate_env, dict(__file__=activate_env))
  
  import django.core.handlers.wsgi
  _application = django.core.handlers.wsgi.WSGIHandler()
  
  def application(environ, start_response):
      # DB
      # .... envirtonment variables ....
  
      return _application(environ, start_response)
  </code></pre>
  
  <p>When I comment out this line:</p>
  
  <pre><code>execfile(activate_env, dict(__file__=activate_env))
  </code></pre>
  
  <p>It no longer activates the <code>virtualenv</code> and I can load the site fine, but I can't use <code>virtualenv</code> obviously to host multiple sites with different dependencies.</p>
  
  <p>Is this a known issue, or am I missing a piece of configuration somewhere that someone could help point out?</p>
  
  <p>I'm running:</p>
  
  <pre><code>Django 1.5.4
  viritualenv 1.11.1
  Apache2.2
  Ubuntu 13.04
  Python 2.7.4
  </code></pre>
  
  <p>Thanks in advance.</p>