(UPDATE: I\'ve made a better question with a better answer here. I was going to delete this question, but some of the answers might prove useful to future searchers.)
M
Maybe an issue is in PYTHONPATH . According to Python documantation https://docs.python.org/2.7/tutorial/modules.html#the-module-search-path it searches for modules in :
- the directory containing the input script (or the current directory).
- PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).
- the installation-dependent default.
You can add some code to your application - printing sys.path variable to make sure your applcation's path is also there.
import sys
from jinja2 import Environment, PackageLoader # no prob, jinja2 correctly installed using pip
print sys.path # printing your sys.path
env = Environment(loader=PackageLoader('mypkg', 'template')) # causes server error
If it's not You can add by
sys.path.append(path_to_your_application)