Open source cms for mobile and desktop websites

Deploying the application

You can use every Python WSGI compatible server to run the application. Here is a short description of the two main approaches:

  1. The Pyramid integrated webserver

    Pyramid comes with a simple http server written in Python. This is the best choice for development, testing and small websites. The setup is very easy and does not require much administration. The servers configuration is included in development.ini and production.ini.

  2. nginx or Apache as proxy server

    This requires more configuration but offers all options of these powerful webservers. The application can be connected via proxy modules and the integrated webserver.

Using nginx as proxy

This example shows how to set up nginx as proxy server for Pyramid.

Start Pyramid with production.ini. No more configuration is required.

../bin/pserve production.ini

Copy into nginx.conf:

server {
    server_name  www.the_website_domain.com;

    access_log  log/access.log;

    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size    300m;
        proxy_pass              http://127.0.0.1:6543;
        proxy_redirect          off;
    }
}

Replace www.the_website_domain.com with the website’s domain.

Development and production setups

development.ini and production.ini start the website with different system configurations. Page rendering and especially the startup is much faster in production mode. The main differences are:

Development mode

  • templates are reloaded
  • http-cache headers are disabled
  • additional debugging information is provided
  • the database structure is checked on startup and missing fields are added automatically

Production

  • cache and modified-since http headers are added

Pyramid Environment Variables and .ini File Settings

Pyramid can be configured by many options described here in detail.

© 2013 Nive GmbH