Welcome, Guest Login

Public Cloud Center

Getting Started With Python

Last Updated: Jul 10, 2015 10:38AM EDT

Modulus supports the seamless deployment of Python applications. The Python runtime supports multiple version of Python and serves static content using a configurable nginx frontend.

CREATE PROJECT

Creating a Python project can be done by choosing Python on the web portal or when creating a project using the CLI.

DEPLOYING

Deploying a Python application is done by simply deploying the directory containing your Python source code. Modulus will install your pip dependencies from requirements.txt.

$ cd path/to/project
$ modulus deploy

SETTING PYTHON VERSION

Modulus pre-installs Python versions 2.5.6, 2.6.9, 2.7.10, 3.2.6, 3.3.6, and 3.4.3. You can change the version of Python by deploying an application manifest file (app.json) in the root of your project or by including .python-version file in the root directory. You can set the version to any version (even those not listed), but versions not listed above will require the Python version to be installed prior to deploying, which may delay your deploy. If no version is specified, the project will default to 2.7.10.

{
  "engines": {
    "python": "2.7.10"
  }
}

CUSTOM NGINX CONFIGURATION

Modulus provides a reasonable base nginx and site configuration that will serve static assets for Python applications. You can provide your own site-specific nginx configuration by deploying a "sites-enabled" folder with configuration files in the root of your project. All config files located in this folder will be included by nginx.

EXAMPLE: DEPLOYING DJANGO

Django is the default method for running a Python application. Django applications are run using gunicorn with an nginx proxy that also serves static assets. Static assets are expected to be located in a directory named static.

The run image automatically calls migrate (./manage.py migrate) for you.

Django applications are started by running gunicorn -b unix:/mnt/home/app.sock wsgi - you may provide your own start command by adding a start script to app.json. Note that your start command must bind to the socket at /mnt/home/app.sock unless you provide custom nginx configuration that handles proxying to your application.

Overriding the start command in app.json

{
  "scripts": {
    "start": "gunicorn -b unix:/mnt/home/app.sock wsgi"
  }
}

Contact Us

    Our Support Policy
    Submit a Support Request

  • Public Cloud Support Hours
    9am-5pm EST Mon-Fri
    Outside of these hours response times may be up to 24hrs.


    Submit a support ticket by clicking 'status and support' icon on the left side of this page.



help@hellotangible.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en_us/portal/articles/autocomplete