The following legacy information applies only to certain accounts located on silk21 which are configured for the Phusion Passenger app server..

Silk will execute Python code written using the WSGI model. How it does so depends on which silk platform version your account is hosted on.

Choosing a version of Python

You can choose among multiple versions of Python:

Silk platform Python version Command-line path
silkv2 2.7 /usr/bin/python
silkv2 3.5 /usr/local/bin/python35
silkv2 3.6 (default) /usr/local/bin/python36

If you need to switch Python versions, you can do so by creating or editing your site's .silk.ini file (for example ~/www-root/.silk.ini) and adding the version to the [python] section:

version = 3.6

Valid version choices are default, any of the versions listed in the table above, or newest (which provides the newest available on the system).

Web applications

Python applications use Phusion Passenger as an app server. You can run an application by placing the following in an .htaccess file in your ~/www-root/ directory:

PassengerAppType wsgi
PassengerStartupFile wsgi.py
PassengerAppRoot /users/m/y/mynetid/www-root
PassengerPython /usr/bin/python

PassengerStartupFile should be the script that launches your application.

PassengerAppRoot should be the full path to the directory where your application's startup file is located.

PassengerPython should be the full path to your preferred version of Python.

Reloading applications

An application needs to be restarted for code changes to take effect. You can do this by killing the current application process:

[myusername@silk21 ~]$ pkill -u myusername -f wsgi-loader

Your application will relaunch the next time it is requested from a web browser.


Python modules are managed using the pip command.

You can see which modules are currently installed by typing pip list, or see which you have installed yourself with pip list --user.

Additional modules can be installed by typing pip install --user <modulename>, which will place them in your home directory, under ~/.local/. Scripts or commands included with a module are placed in ~/.local/bin/ and can either be run directly from there or added to your PATH by adding a line such as the following to ~/.bash_profile:

export PATH=~/.local/bin:$PATH