Python Hosting Overview

Enabling Python Hosting

1. In order to enable Python hosting for your users you should add the appropriate cartridge using your JCA. For that navigate to Jelastic Template repository and find Python cartridge in the list.

Note that we provide a basic cartridge version. If you would like to extend it or add some additional features, fork Python cartridge repository and make all the changes needed.

2. Add and publish the desired Python cartridge via JCA as it is described in the Add Cartridge document.

3. Then navigate to your JCA > System settings > User Interface.

Find the ENGINE_TYPES parameter and ensure “python” is added to the list of available programming languages. If you use several programming languages, then just enumerate them comma separated.

Note: In case you would like to enable all languages supported by Jelastic (i.e. Java, PHP, Ruby, Python and Node.js) for your users, you can state “*” value instead of comma separated list.

4. After that all users will see a Python tab near Java, PHP and Ruby in the Environment topology window.

Python Application Servers

Currently we support Apache application server for Python applications hosting.

It is implemented by means of Apache + mod_wsgi bundle. 

Version Management

Jelastic provides three Python versions available:

  • 2.7
  • 3.3
  • 3.4
All of these versions are preinstalled in each Python container. User can choose desired version while environment creation or change it afterwards via environment topology wizard. Workflow is described in the Python Versions document. 

Packages Management

Management of the required software packages while application deployment is provided by pip, popular Python package management system.

There are two ways for downloading and installing the necessary Python modules:

  • write a list of required modules in the requirements.txt file, located at root of your project package. It will be read by deployment script in order to automatically install these modules with the help of pip.

  • connect to your container via SSH and operate with the following commands:

    pip install {package_name} - to install a necessary module
    pip uninstall {package_name} - to remove previously installed module
    pip install --upgrade {package_name} - to update specified module to the latest version
    pip install -r requirements.txt - to install all the modules, listed in the requirements.txt file
    pip list - to see the set of already installed modules

    Using additional commands and their attributes you can also specify the desired module version, configure relative dependencies resolving, show details on installed modules or search for the necessary ones in the PiPI packages repository. To find out more details on commands you can use, navigate to the pip user guide.

Available Frameworks

For now Jelastic supports the following Python frameworks:

You can easily deploy already packaged application or use SSH feature for building and deploying a new one.

Note:
  • in order to deploy your package its root should contain the following files:
    • requirements.txt file with the names of all Python modules your application requires
    • application file with the entry point script for running your application using Apache mod_wsgi considering your virtual environment

  • more detailed instructions on building new applications using above mentioned frameworks and creating entry point scripts will be added in the nearest future

Log Files

Jelastic makes the following log files available for Python WSGI:

  • access_log-{date}
  • error_log-{date}

These files can be seen by pressing Log button next to the Apache application server in the environment.