This is probably one of the strangest errors that I have ever ran into when using OpenCV. There is a lot going on, so let me try to explain this to the best of my ability.
Wrong
imagePath = os.path.dirname(__file__) + "/1.jpg"
Right
from os.path import abspath, join, dirname
imagePath = abspath( join(dirname(__file__), "1.jpg") )
I had a similar issue and found a fix -> just add to your apache configuration:
WSGIScriptAlias application-group=%{GLOBAL}
Apparently it happens when you have an extension module not designed to work in sub interpreter. The above forces it to run in main interpreter.
Sources: django apache mod-wsgi hangs on importing a python module from .so file http://blog.rtwilson.com/how-to-fix-flask-wsgi-webapp-hanging-when-importing-a-module-such-as-numpy-or-matplotlib/