Setting up Python (WSGI app)

Note

AUTOM8N includes a GUI installer of additional modules required for passenger project. Please place a requirements.txt file in the application root and AUTOM8N can install the requirements specified in this file

1. Enable the Phusion Passenger module /usr/nginx/scripts/nginx-passenger-setup.sh

2. To install additional python

root@cpanel1 [~]# pythonz install 3.4.2

root@cpanel1 [~]# pythonz list
# Installed Python versions
  CPython-2.7.8
  CPython-3.4.2

root@cpanel1 [~]# pythonz locate 3.4.2
/usr/local/pythonz/pythons/CPython-3.4.2/bin/python3

3. Register the python backend

root@cpanel1 [~]# /opt/nDeploy/scripts/update_backend.py add PYTHON CPython-3.4.2 /usr/local/pythonz/pythons/CPython-3.4.2/bin/python3

Bootstrapping PIP

PIP can be used to add additional python modules by cPanel user

wget https://bootstrap.pypa.io/get-pip.py

root@cpanel1 [~]# pythonz locate 3.4.2
/usr/local/pythonz/pythons/CPython-3.4.2/bin/python3

root@cpanel1 [~]# /usr/local/pythonz/pythons/CPython-3.4.2/bin/python3 get-pip.py

To install PIP packages as user add the –user flag

gnusys@gnusys.net [~]# /usr/local/pythonz/pythons/CPython-2.7.8/bin/pip install --user PyYAML

Additional Reference https://www.phusionpassenger.com/library/deploy/nginx/deploy/python/

Additonal Environment variables can be set per user using custom application templates https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_env_var