learning-unlimited/ESP-Website — pull request #964 by jmoldow (2014-01-20 04:39:56+00:00)
Title: Fixes virtualenv activation

/esp/dbmail_cron.py was not activating virtualenv, so recently it was
failing to run because could not import new dependencies that weren't
installed globally on the system (specifically, it couldn't import
markdown, which is imported by one of the modules that is imported by
the cache loader). Fixes this error by activating virtualenv in
dbmail_cron.

While doing this, I noticed that we were doing the activation wrong, in
two ways:

- The try/except block was originally designed to make it optional to
use virtualenv. However, we are always going to be using virtualenv.
So instead of helping us, the try/except class was masking our own
bugs. This commit removes the try/except blocks.

- esp.wsgi was not using os.path.realpath(__file__), so it wasn't
activating the correct file. We didn't notice this because of the
try/except block, and probably because it doesn't matter for esp.wsgi.
Fixes this bug.