Here is what I found out after some research.
It is impossible to install anything that interferes with Apache on a managed server. For example it is impossible to install Mod_python or CherryPy because it requires modifying the configuration of Apache.
It is also impossible to install Python packages like Jinja using pip or easy_install.
But it is possible to install Jinja by copying the source files in any folder the user has access to and tell Python to import from that folder.
Installing with pip or easy_install would take care of the dependencies, manually copying the files doesn't. So all the dependencies must be manually copied as well.
The last problem that I found was that Jinja requires the module pkg_resources, which is installed with easy_install, which can't be used (see above). The solution was to create a custom loader. I copied the one from the documentation that worked well.
Here are the steps that I followed:
- Create a folder called
lib
- Download Jinja and copy it in the
lib/jinja2
folder
- Download MarkupSafe and copy it in the
lib/markupsafe
folder
- Add the
lib
folder to the import path: sys.path.insert(0, "lib")
- Import Jinja as usual:
import jinja2
- Create a custom loader as suggested here
Then I password protected the lib
folder with cPanel and installed Peewee and other packages.
I would really like to use CherryPy, but for my little low traffic this will do.