web2py Application Development Cookbook

3.7 (3 reviews total)
By Mariano Reingart , Bruno Cezar Rocha , Jonathan Lundell and 4 more
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Deploying web2py

About this book

web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. It is written and programmable in Python, and straightforward to run. web2py implements Model-View-Controller design, server-side form validation, and postbacks that make the code more readable, scalable, and maintainable. Are you familiar with web2py, and interested in gaining more advanced knowledge?web2py Application Development Cookbook gives you the necessary knowledge to make you a web2py expert. Right from teaching you about the database abstraction layer to adding AJAX effects to recipes about recipe, the book will make you a master of web2py through advanced practical recipes without any drudgery or straining the brain.web2py Application Development Cookbook is the tool you will need to expand and enhance your web2py skills.This book begins with teaching you running web2py in various different systems followed by building simple applications. It focuses on database abstraction layer next and then explains building advanced forms. Adding stunning AJAX effects, using third party libraries and recipes on web services follow. Advanced recipes on authentication and authorization are taught and then routing and reporting recipes claim your attention. There is a final wrap-up with useful, interesting tips and tricks which you will really enjoy.In short, this book will make you an expert in web2py in a trouble-free, quick, and easy manner.

Publication date:
March 2012


Chapter 1. Deploying web2py

In this chapter, we will cover the following recipes:

  • Installing web2py on Windows (from source code)

  • Installing web2py on Ubuntu

  • Setting up a production deployment on Ubuntu

  • Running web2py with Apache, mod_proxy, and mod_rewrite

  • Running web2py with Lighttpd

  • Running web2py with Cherokee

  • Running web2py with Nginx and uWSGI

  • Running web2py on shared hosts using CGI

  • Running web2py on shared hosts with mod_proxy

  • Running web2py from a user-defined folder

  • Installing web2py as a service in Ubuntu

  • Running web2py with IIS as proxy

  • Running web2py with ISAPI



In this chapter, we discuss how to download, set up, and install web2py in different systems and with different web servers.


All of them require that you download the latest web2py source from the website: http://web2py.com, unzip it under /home/www-data/web2py on Unix and Linux systems, and on c:/web2py on Windows systems. In various places, we will assume that the public IP address of the host machine is; replace this with your own IP address or host name. We will also assume web2py starts on port 8000, but there is nothing special about this number; change it if you need to.


Installing web2py on Windows (from source code)

Although there is a binary distribution for Windows environments (packaging executables and standard libraries), web2py is open source, and can be used with a normal Python installation.

This method allows working with the latest releases of web2py, and customizing the python modules to be used.

Getting ready

First of all, you must install Python. Download your preferred 2.x version (not 3.x) from: http://www.python.org/download/releases/.

Although newer versions include more enhancements and bug fixes, previous versions have more stability and third-party library coverage. Python 2.5.4 has a good balance within features and proven stability history, with good binary libraries support. Python 2.7.2 is the latest production release for this platform at the time of this writing, so we will use it for the examples.

After downloading your preferred Windows Python installer (that is python-2.7.2.msi), double-click to install it. The default values are fine for most cases, so press Next until it finishes the installation.

You will need Python Win32 extensions to use the web2py taskbar or Windows service. You can install pywin32 from: http://starship.python.net/~skippy/win32/Downloads.html.

Prior to using web2py, you may also need some dependencies to connect to databases. SQLite and MySQL drivers are included in web2py. If you plan to use another RDBMS, you will need to install its driver.

For PostgreSQL , you can install the psycopg2 binary package (for Python 2.7, you should use psycopg2-2.3.1.win32-py2.7-pg9.0.1-release.exe): http://www.stickpeople.com/projects/python/win-psycopg/ (notice that web2py requires psycopg2 and not psycopg).

For MS SQLServer or DB2, you need pyodbc : http://code.google.com/p/pyodbc/downloads/list.

How to do it...

At this point, you can use web2py with your preferred database.

  1. Download the source package from web2py official website: http://www.web2py.com/examples/static/web2py_src.zip, and unzip it.

    As web2py doesn't requires installation, you can unzip it in any folder. Using c:\web2py is convenient, to keep pathnames short.

  2. To start it, double-click web2py.py. You can also start it from the console:

    cd c:\web2py
    c:\python27\python.exe web2py.py
  3. Here you can add command-line parameters (-a to set an admin password, -p to specify an alternate port, and so on). You can see all the startup options with:

    C:\web2py>c:\python27\python.exe web2py.py --help

How it works...

web2py is written in Python, a portable, interpreted and dynamic language that doesn't require compilation or complicated installation to run. It uses a virtual machine (such as Java and .Net), and it can transparently byte-compile your source code on the fly when you run your scripts.

For novice users' convenience, there is web2py Windows binary distribution available at the official site, which is precompiled to a bytecode, packaged in a zip file with all the required libraries (dll/pyd), and is present with an executable entry-point file (web2py.exe), but there is no noticeable difference running web2py from source.

There's more...

Running web2py from the source package in Windows has many advantages, a few of which are listed as follows:

  • You can more easily use third-party libraries, such as Python Imaging (look at Python package index, where you can install more than ten thousand modules!).

  • You can import web2py functionality (for example, the Database Abstraction Layer (DAL)) from other Python programs.

  • You can keep web2py updated with the latest changes, help to test it, and submit patches.

  • You can browse the web2py source code, tweak it for your custom need, and so on.


Installing web2py in Ubuntu

This recipe covers how to install web2py in a development environment using the Ubuntu desktop. Installation in a production system will be covered in the next recipe.

We assume that you know how to use a console and install applications using the console. We will use the latest Ubuntu desktop, at this writing: Ubuntu Desktop 10.10.

Getting ready

We are going to install web2py in your home directory, so fire up the console.

How to do it...

  1. Download web2py.

    cd /home
    mkdir www-dev 
    cd www-dev
    wget http://www.web2py.com/examples/static/web2py_src.zip (get web2py)
  2. When the download is complete, unzip it:

    unzip -x web2py_src.zip
  3. Optionally install the tk library for Python, if you want the GUI.

    sudo apt-get install python-tk


    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support, and register to have the files e-mailed directly to you. The code files are also uploaded at the following repository: https://github.com/mdipierro/web2py-recipes-source.

    All the code is released under the BSD license (http://www.opensource.org/licenses/bsd-license.php) unless otherwise stated in the source file.

  4. To start web2py, access the web2py directory and run web2py.

    cd web2py
    python web2py.py

    After installation, each time you run it, web2py will ask you to choose a password. This password is your administrative password. If the password is left blank, the administrative interface will be disabled.

  5. Enter in your browser to check if everything is working OK.


    The administrative interface: is only accessible through localhost, and always requires a password. It can also be accessed through an SSH tunnel.

There's more...

You can use some other options. For example, you can specify the port with the option -p port and IP address with the option -i It's useful to specify the password, so you don't have to enter it every time you start web2py; use option -a password. If you want help on other options, run web2py with the -h or –help option.

For example:

python web2py.py -i -p 8000 -a mypassword --nogui

Setting up a production deployment on Ubuntu

This recipe describes how to install web2py in a production environment using the Ubuntu server. This is the recommended method to deploy web2py in production.

Getting ready

We assume that you know how to use a console and install applications using a repository and commands. We will use the latest Ubuntu server at the time of writing: Ubuntu Server 10.04 LTS.

In this recipe we will learn how to:

  • Install all modules needed to run web2py on Ubuntu

  • Install web2py in /home/www-data/

  • Create a self-signed SSL certificate

  • Set up web2py with mod_wsgi

  • Overwrite /etc/apache2/sites-available/default

  • Restart Apache

First, we need to be sure that the system is up-to-date. Upgrade the system with these commands:

sudo apt-get update 
sudo apt-get upgrade

How to do it...

  1. Let's start by installing postgreSQL:

    sudo apt-get install postgresql 
  2. We need to unzip and open ssh-server, if it's not installed already.

    sudo apt-get install unzip
    sudo apt-get install openssh-server
  3. Install Apache 2 and mod-wsgi:

    sudo apt-get install apache2 
    sudo apt-get install libapache2-mod-wsgi 
  4. Optionally, if you plan to manipulate images, we can install the Python Imaging Library (PIL):

    sudo apt-get install python-imaging 
  5. Now we need to install web2py. We'll create www-data in /home, and extract the web2py source there.

    cd /home 
    sudo mkdir www-data 
    cd www-data 
  6. Get the web2py source from the web2py site:

    sudo wget http://web2py.com/examples/static/web2py_src.zip 
    sudo unzip web2py_src.zip 
    sudo chown -R www-data:www-data web2py
  7. Enable the Apache SSL and EXPIRES modules:

    sudo a2enmod expires 
    sudo a2enmod ssl
  8. Create a self-signed certificate:

    You should obtain your SSL certificates from a trusted Certificate Authority, such as verisign.com, but for testing purposes you can generate your own self-signed certificates. You can read more about it at: https://help.ubuntu.com/10.04/serverguide/C/certificates-and-security.html.

  9. Create the SSL folder, and put the SSL certificates inside it:

    sudo openssl req -new -x509 -nodes -sha1 -days 365 -key \
    /etc/apache2/ssl/self_signed.key > \
    sudo openssl x509 -noout -fingerprint -text < \
    /etc/apache2/ssl/self_signed.cert > \
  10. If you have problem with permissions, use sudo -i.

  11. Edit the default Apache configuration with your editor.

    sudo nano /etc/apache2/sites-available/default
  12. Add the following code to the configuration:

    NameVirtualHost *:80 
    NameVirtualHost *:443 
    <VirtualHost *:80> 
      WSGIDaemonProcess web2py user=www-data group=www-data 
      WSGIProcessGroup web2py 
      WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py 
      <Directory /home/www-data/web2py> 
        AllowOverride None 
        Order Allow,Deny 
        Deny from all 
        <Files wsgihandler.py> 
          Allow from all 
      AliasMatch ^/([^/]+)/static/(.*) \ /home/www-data/web2py/applications/$1/static/$2 
      <Directory /home/www-data/web2py/applications/*/static/> 
        Options -Indexes 
        Order Allow,Deny 
        Allow from all 
      <Location /admin> 
        Deny from all 
      <LocationMatch ^/([^/]+)/appadmin> 
        Deny from all 
      CustomLog /var/log/apache2/access.log common 
      ErrorLog /var/log/apache2/error.log 
    <VirtualHost *:443> 
      SSLEngine on 
      SSLCertificateFile /etc/apache2/ssl/self_signed.cert 
      SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key 
      WSGIProcessGroup web2py 
      WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py 
      <Directory /home/www-data/web2py> 
        AllowOverride None 
        Order Allow,Deny 
        Deny from all 
        <Files wsgihandler.py> 
          Allow from all 
      AliasMatch ^/([^/]+)/static/(.*) \ /home/www-data/web2py/applications/$1/static/$2 
      <Directory /home/www-data/web2py/applications/*/static/> 
        Options -Indexes
        ExpiresActive On 
        ExpiresDefault "access plus 1 hour" 
        Order Allow,Deny 
        Allow from all 
      CustomLog /var/log/apache2/access.log common 
      ErrorLog /var/log/apache2/error.log 
  13. Restart the Apache server:

    sudo /etc/init.d/apache2 restart cd /home/www-data/web2py sudo -u www-data python -c "from gluon.widget import console; \console();"
      sudo -u www-data python -c "from gluon.main \import save_password; \save_password(raw_input('admin password: '),443)"
  14. Enter in your browser to check if everything is working OK, replacing with your public IP address.

There's more...

Everything that we did can be done automatically using a script provided by web2py:

wget http://web2py.googlecode.com/hg/scripts/setup-web2py-\ubuntu.sh
chmod +x setup-web2py-ubuntu.sh 
sudo ./setup-web2py-ubuntu.sh

Running web2py with Apache, mod_proxy, and mod_rewrite

Apache httpd is the most popular HTTP server, and having Apache httpd on a large installation is a must, just like panettone on Christmas day in Italy. Like the panettone, Apache comes in many flavors and with different fillings. You have to find the one you like.

In this recipe, we configure Apache with mod_proxy, and refine it through mod_rewrite rules. This is a simple, but robust solution. It can be used to increase web2py scalability, throughput, security, and flexibility. These rules should satisfy both the connoisseur and the beginner.

This recipe will show you how to make a web2py installation on a host appear as part of a website, even when hosted somewhere else. We will also show how Apache can be used to improve the performance of your web2py application, without touching web2py.

Getting ready

You should have the following:

  • web2py installed and running on localhost with the built-in Rocket webserver (port 8000)

  • Apache HTTP server (httpd) version 2.2.x or later

  • mod_proxy and mod_rewrite (included in the standard Apache distribution)

On Ubuntu or other Debian-based servers, you can install Apache with:

apt-get install apache

On CentOS or other Fedora-based Linux distributions, you can install Apache with:

yum install httpd

For most other systems you can download Apache from the website http://httpd.apache.org/, and install it yourself with the provided instructions.

How to do it...

Now that we have Apache HTTP server (from now on we will refer to it simply as Apache) and web2py both running locally, we must configure it.

Apache is configured by placing directives in plain text configuration files. The main configuration file is usually called httpd.conf . The default location of this file is set at compile time, but may be overridden with the -f command line flag. httpd.conf may include other configuration files. Additional directives may be placed in any of these configuration files.

The configuration files may be located in /etc/apache2, in /etc/apache, or in /etc/httpd, depending on the details of the OS and the Apache version.

  1. Before editing any of the files, make sure that the required modules are enabled from the command-line shell (bash), type:

    a2enmod proxy
    a2enmod rewrite

    With mod_proxy and mod_rewrite enabled, we are now ready to set up a simple rewrite rule to proxy forward HTTP requests received by Apache to any other HTTP server we wish. Apache supports multiple VirtualHosts, that is, it has the ability to handle different virtual host names and ports within a single Apache instance. The default VirtualHost configuration is in a file called /etc/<apache>/sites-available/default, where <apache> is apache, apache2, or httpd.

  2. In this file each VirtualHost is defined by creating an entry as follows:

    <VirtualHost *:80>

    You can read the in-depth VirtualHost documentation at http://httpd.apache.org/docs/2.2/vhosts/.

  3. To use RewriteRules, we need to activate the Rewrite Engine inside the VirtualHost:

    <VirtualHost *:80>
        RewriteEngine on
  4. Then we can configure the rewrite rule:

    <VirtualHost *:80>
      RewriteEngine on
      # make sure we handle the case with no / at the end of URL
      RewriteRule ^/web2py$ /web2py/ [R,L]
      # when matching a path starting with /web2py/ do use a reverse
      # proxy
      RewriteRule ^/web2py/(.*) http://localhost:8000/$1 [P,L]

    The second rule tells Apache to do a reverse proxy connection to http://localhost:8000, passing all the path components of the URL called by the user, except for the first, web2py. The syntax used for rules is based on regular expressions (regex), where the first expression is compared to the incoming URL (the one requested by the user).

    If there is a match, the second expression is used to build a new URL. The flags inside [and] determine how the resulting URL is to be handled. The previous example matches any incoming request on the default VirtualHost with a path that begins with /web2py, and generates a new URL prepending http://localhost:8000/ to the remainder of the matched path; the part of the incoming URL that matches the expression .* replaces $1 in the second expression.

    The flag P tells Apache to use its proxy to retrieve the content pointed by the URL, before passing it back to the requesting browser.

    Suppose that the Apache Server responds at the domain www.example.com; then if the user's browser requests http://www.example.com/web2py/welcome, it will receive a response with the contents from the scaffolding application of web2py. Thats is, it would be as if the browser had requested http://localhost:8000/welcome.

  5. There is a catch: web2py could send an HTTP redirect, for instance to point the user's browser to the default page. The problem is that the redirect is relative to web2py's application layout, the one that the Apache proxy is trying to hide, so the redirect is probably going to point the browser to the wrong location. To avoid this, we must configure Apache to intercept redirects and correct them.

    <VirtualHost *:80>
      #make sure that HTTP redirects generated by web2py are reverted / -> /web2py/
      ProxyPassReverse /web2py/ http://localhost:8000/
      ProxyPassReverse /web2py/ /
      # transform cookies also
      ProxyPassReverseCookieDomain localhost localhost
      ProxyPassReverseCookiePath / /web2py/
  6. There is yet another issue. Many URLs generated by web2py are also relative to the web2py context. These include the URLs of images or CSS style sheets. We have to instruct web2py how to write the correct URL, and of course, since it is web2py, it is simple and we do not have to modify any code in our application code. We need to define a file routes.py in the root of web2py's installation, as follows:

    routes_out=((r'^/(?P<any>.*)', r'/web2py/\g<any>'),)
  7. Apache can, at this point, transform the received content before sending it back to the client. We have the opportunity to improve website speed in several ways. For example, we can compress all content before sending it back to the browser, if the browser accepts compressed content.

    # Enable content compression on the fly,
    # speeding up the net transfer on the reverse proxy.
    <Location /web2py/>
      # Insert filter
      SetOutputFilter DEFLATE
      # Netscape 4.x has some problems...
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      # Netscape 4.06-4.08 have some more problems
      BrowserMatch ^Mozilla/4\.0[678] no-gzip
      # MSIE masquerades as Netscape, but it is fine
      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
      # Don't compress images
      SetEnvIfNoCase Request_URI \
           \.(?:gif|jpe?g|png)$ no-gzip dont-vary
      # Make sure proxies don't deliver the wrong content
      Header append Vary User-Agent env=!dont-vary

    It is possible in the same way, just by configuring Apache, to do other interesting tasks, such as SSL encryption, load balancing, acceleration by content caching, and many other things. You can find information for those and many other setups at http://httpd.apache.org.

Here is the complete configuration for the default VirtualHost as used in the following recipe:

<VirtualHost *:80>
  ServerName localhost
  # ServerAdmin: Your address, where problems with the server
  # should
  # be e-mailed. This address appears on some server-generated
  # pages,
  # such as error documents.  e.g. [email protected]
  ServerAdmin [email protected]

  # DocumentRoot: The directory out of which you will serve your
  # documents. By default, all requests are taken from this
  # directory,
  # but symbolic links and aliases may be used to point to other 
  # locations.
  # If you change this to something that isn't under /var/www then 
  # suexec will no longer work.
  DocumentRoot "/var/www/localhost/htdocs"

  # This should be changed to whatever you set DocumentRoot to.
  <Directory "/var/www/localhost/htdocs">
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks 
    #   SymLinksifOwnerMatch ExecCGI MultiViews
    # Note that "MultiViews" must be named *explicitly* ---
    # "Options All"
    # doesn't give it to you.
    # The Options directive is both complicated and important.
    # Please
    # see http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    Options Indexes FollowSymLinks
    # AllowOverride controls what directives may be placed in
    # .htaccess
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride All

    # Controls who can get stuff from this server.
    Order allow,deny
    Allow from all

  RewriteEngine on
  # make sure we handle when there is no / at the end of URL
  RewriteRule ^/web2py$ /web2py/ [R,L]

  # when matching a path starting with /web2py/ do a reverse proxy 
  RewriteRule ^/web2py/(.*) http://localhost:8000/$1 [P,L]

  # make sure that HTTP redirects generated by web2py are reverted 
  # / -> /web2py/
  ProxyPassReverse /web2py/ http://localhost:8000/
  ProxyPassReverse /web2py/ /
  # transform cookies also
  ProxyPassReverseCookieDomain localhost localhost
  ProxyPassReverseCookiePath / /web2py/

  # Enable content compression on the fly speeding up the net 
  # transfer on the reverse proxy.
  <Location /web2py/>
    # Insert filter
    SetOutputFilter DEFLATE
    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # Don't compress images
    SetEnvIfNoCase Request_URI \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

You must restart Apache for any change to take effect. You can use the following command for the same:

apachectl restart

Running web2py with Lighttpd

Lighttpd is a secure, fast, compliant, and a very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint as compared to other web servers, and takes care of the cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting, and many more) make Lighttpd the perfect web server software for every server that suffers load problems.

This recipe was derived from official web2py book, but while the book uses FastCGI mod_fcgi to expose web2py functionality behind a Ligthttpd web server, here, we use SCGI instead. The SCGI protocol that we use here is similar in intent to FastCGI, but simpler and faster. It is described at the following website:


SCGI is a binary protocol for inter-process communication over IP. SCGI is tailored for the specific task of web server to CGI application communication. The CGI standard defines how a web server can delegate to an external application the dynamic generation of an HTTP response.

The problem with CGI is that, for every incoming request a new process has to be created. Process creation can take longer than response generation in some contexts. This is true in most interpreted language environments, where the time to load a new instance of the interpreter can be longer than the execution of the program itself.

FastCGI addresses this problem by using long-running processes to answer to more than one request without exiting. This is beneficial, in particular, for interpreted programs, because the interpreter does not need to be restarted each time. SCGI was developed after FastCGI experience to reduce the complexity required to convert a CGI to a FastCGI application, allowing better performance. SCGI is a standard module of Lighttpd, and is available for Apache as well.

Getting ready

You should have:

If you have setuptools, you can install SCGI, paste, and wsgitools, as follows:

easy_install scgi
easy_install paste
easy_install wsgitools

You will also need a script to start an SCGI server, configured for web2py that may or may not come with web2py, depending on the version, so we have supplied one to this recipe.

How to do it...

Now, you have to write the script to start the SCGI server that will be listening to Lighttpd requests. Don't worry, even if it is very short and easy, we provide one ready to copy here:

#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys
import os

path = os.path.dirname(os.path.abspath(__file__))
sys.path = [path]+[p for p in sys.path if not p==path]

import gluon.main

  application = gluon.main.appfactory(
  application = gluon.main.wsgibase

  from gluon.settings import global_settings
  global_settings.web2py_crontype = 'soft'

  import paste.util.scgiserver as scgi
  scgi.serve_application(application, '', 4000).run()except ImportError:
  from wsgitools.scgi.forkpool import SCGIServer
  SCGIServer(application, port=4000).run()
  1. Copy the previous script, and put it in the root of your web2py installation with the name scgihandler.py. Start the SCGI server, and leave it running in the background:

    $ nohup python ./scgihandler.py &

    Now we are ready to configure lighttpd.

    We provide a simple lighttpd.conf configuration file here, as an example. Of course, real-world configurations can be much more complex, but the important parts will not differ much.

  2. Append the following lines to your lighttpd.conf:

    server.modules += ( "mod_scgi" )
    # for >= linux-2.6
    server.event-handler = "linux-sysepoll"
    url.rewrite-once = (
      "^(/.+?/static/.+)$" => "/applications$1",
      "(^|/.*)$" => "/handler_web2py.scgi$1",
    scgi.server = ( "/handler_web2py.scgi" =>
      ("handler_web2py" =>
        ( "host" => "",
        "port" => "4000",
        "check-local" => "disable", # important!
  3. This configuration does the following:

    • Loads the SCGI module into Lighttpd

    • Configures the server document root to the root of web2py installation

    • Rewrites the URL, using mod_rewrite, so that incoming requests to static files are served directly by Lighttpd, while all the rest are rewritten to a fake URL beginning with /handler_web2py.scgi

    • Creates an SCGI server stanza: For every request beginning with /handler_web2py.scgi the request is routed to the SCGI server running on at port 4000, skipping the check for the existence of a corresponding local file on the filesystem

  4. Now, check that your configuration is ok:

    $ lighttpd -t -f lighttpd.conf
  5. Then start the server for testing:

    $ lighttpd -D -f lighttpd.conf
  6. You can start/stop/restart the server with the following command:

    $ /etc/init.d/lighttpd start|stop|restart

You will see your web2py application go to the speed of Light(ttpd).


Running web2py with Cherokee

This recipe explains how to run web2py behind a Cherokee web server using uWSGI.

Cherokee is a webserver written in C, similar in intent to Lighttpd: fast, compact, and modular. Cherokee comes with an administrative interface that allows one to manage its configuration, which is difficult to read and modify otherwise. uWSGI is described in its website as a fast (pure C), self-healing, developer/sysadmin-friendly application container server. Cherokee has an included module to talk to uWSGI servers.

How to do it...

  1. Install the package or download, compile, and install the required components. Create the following file in the installation root of web2py, and call it uwsgi.xml:


    This configuration spawns eight processes to manage multiple requests from the HTTP server. Change it as needed, and configure <pythonpath> to the installation root of web2py.

  2. As the user that owns the web2py installation, start the uWSGI server:

    $ uWSGI -d uwsgi.xml
  3. Now launch the Cherokee administrative interface to create a new configuration:

    $ cherokee-admin
  4. Connect to the admin interface with the browser at the following link: http://localhost:9090/.

  5. Go to the Sources section - (A), then click on the + button - (B).

  6. Select Remote Host on (C), then fill the text field at (D) with the IP address, and port to match the configuration in the previous uswgi.xml file.

    Having configured the uWGI source, it is now possible to configure a Virtual Host, and redirect requests through it. In this recipe, we choose the default Virtual Host that is used when no other Virtual Host has a better match for the incoming request.

  7. Click on button (C) to go to Rule Management.

  8. Delete all rules listed on the left. Only the default rule will remain.

  9. Configure the default rule with a uWSGI Handler. Leave the other values unchanged.

  10. If you want Cherokee to serve static files directly from web2py folders, you can add a Regular Expression rule. Click button (A), and select Regular Expression from the drop-down menu at (B). Be aware that this configuration works only if the web2py directory is on the same file system, and is accessible to Cherokee.

  11. Configure the Regular Expressions:

  12. Now you can configure the Static Handler pointing to the applications subdirectory of your web2py installation:

    Remember to save the configuration, and reload or restart Cherokee from the administrative interface; then you are ready to start the uWSGI server.

  13. Change to the correct user ID that was used to install web2py; be aware that using root is not recommended.

  14. Go into the root directory of web2py installation, where you saved the configuration file uwsgi.xml.

  15. Run uWSGI with the -d <logfile> option, so that it runs in the background:

    $ su - <web2py user>
    $ cd <web2py root>
    $ uwsgi -x uwsgi.xml -d /tmp/uwsgi.log

Enjoy the speed!

Getting ready

You should have the following:


Running web2py with Nginx and uWSGI

This recipe explains how to run web2py with the Nginx web server using uWSGI.

Nginx is a free, open-source, high-performance HTTP server, and reverse proxy, written by Igor Sysoev.

Nginx, unlike traditional servers, does not rely on threads to handle requests, rather, it implements an asynchronous architecture. This implies that Nginx uses a predictable amount of memory, even under heavy load, resulting in higher stability and low resource consumption. Nginx now hosts more than seven percent of all domains worldwide.

It should be stressed that even if Nginx is asynchronous, web2py is not. Therefore, web2py will use more resources, the more concurrent requests it handles concurrently. uWSGI is described on its website as a fast (pure C), self-healing, developer/sysadmin-friendly application container server. We will configure Nginx to serve dynamic web2py pages through uWSGI, and serve static pages directly, taking advantage of its low footprint capabilities.

Getting ready

You should have the following:

On Ubuntu 10.04 LTS, you can install uWSGI and Nginx using apt-get, as follows:

apt-get update
apt-get -y upgrade
apt-get install python-software-properties
add-apt-repository ppa:nginx/stable
add-apt-repository ppa:uwsgi/release
apt-get update
apt-get -y install nginx-full
apt-get -y install uwsgi-python

How to do it...

  1. First we need to configure Nginx. Create or edit a file called /etc/nginx/sites-available/web2py.

  2. In the file, write the following:

    server {
      listen          80; 
      server_name     $hostname; 
      location ~* /(\w+)/static/ { 
        root /home/www-data/web2py/applications/; 
      location / { 
        include         uwsgi_params; 
    server { 
      listen          443; 
      server_name     $hostname; 
      ssl                     on; 
      ssl_certificate         /etc/nginx/ssl/web2py.crt; 
      ssl_certificate_key     /etc/nginx/ssl/web2py.key; 
      location / { 
        include         uwsgi_params; 
        uwsgi_param     UWSGI_SCHEME $scheme; 

    As you can see, it passes all dynamical requests to We need to get uWSGI running there.

  3. Create the following file in the installation root of web2py, and call it web2py.xml:

      <app mountpoint="/"> 

    This script assumes that web2py is installed as usual at /home/www-data/web2py/.

  4. Now disable the default configuration, and enable the new one:

    rm /etc/nginx/sites-enabled/default
    rm /etc/nginx/sites-available/default
    ln -s /etc/nginx/sites-available/web2py /etc/nginx/sites-enabled/\web2py
    ln -s /etc/uwsgi-python/apps-available/web2py.xml /etc/uwsgi-\python/apps-enabled/web2py.xml
  5. In order to use HTTPS, you may need to create a self-signed certificate:

    mkdir /etc/nginx/ssl
    cd /etc/nginx/ssl
    openssl genrsa -out web2py.key 1024
    openssl req -batch -new -key web2py.key -out web2py.csr
    openssl x509 -req -days 1780 -in web2py.csr -signkey web2py.key \-out web2py.crt
  6. You will also need to enable web2py admin:

    cd /var/web2py
    sudo -u www-data python -c "from gluon.main import save_password;\save_password('$PW', 443)"
  7. Once you are done, restart both uWSGI and Nginx:

    /etc/init.d/uwsgi-python restart
    /etc/init.d/nginx restart

web2py comes with a script that will perform this setup for you automatically:



Running web2py on shared hosts using CGI

This recipe explains how to configure web2py to run on a shared host with login (but not root) access.

With login or FTP access to a shared host, the user isn't able to configure the web server, and must live within the host's configured constraints. This recipe assumes a typical Unix-based or Linux-based shared host running Apache.

Two deployment methods are possible, depending on how the system is configured. If Apache's mod_proxy is available, and the host permits long-running processes, running web2py's built-in server as an Apache proxy is straightforward and efficient. If mod_proxy is not available, or the host prohibits long-running processes, we're limited to the CGI interface, which is simple to configure and almost universally available, but is also slow, since the Python interpreter must run and load web2py for each request.

We'll start with CGI deployment, the simpler case.

Getting ready

We'll assume that the root of your website is /usr/www/users/username, and that /usr/www/users/username/cgi-bin is your CGI binaries directory. If your details differ, obtain the actual values from your provider, and modify these instructions accordingly.

For security reasons, here, we also assume your host supports running CGI scripts as the local user (cgiwrap). This procedure may vary from host to host, if it's available at all; check with your provider.

Download the web2py source to your cgi-bin directory. For example:

cd cgi-bin
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
rm web2py_src.zip

Alternatively, unzip the web2py source locally, and upload it to the host through FTP.

How to do it...

  1. In your web root directory, create the file .htaccess, if necessary, and add the following lines (changing paths as required):

    SuexecUserGroup <yourusername> <yourgroup>
    RewriteEngine on
    RewriteBase /usr/www/users/username
    RewriteRule ^(welcome|examples|admin)(/.*)?$ \
  2. Change its permissions with the following:

    chown 644 .htaccess
  3. Now access http://yourdomain.com/welcome, or (depending on your provider) http://hostingdomain.com/username/welcome.

  4. If you get access errors at this point, examine the most recent file in web2py/applications/welcome/errors/, using the tail command. This format isn't especially friendly, but it can provide useful clues. If the errors directory is empty, you may need to double-check that the errors directory is writable by the web server.


Running web2py on shared hosts with mod_proxy

Using mod_proxy has two major advantages over CGI deployment discussed in the previous recipe: web2py runs continuously, so performance is considerably better, and it runs as your local user, which improves security. Because from web2py's perspective it appears to be running on localhost, the admin application can run, but if you don't have SSL operation available, you may want to disable admin for security reasons. SSL setup is discussed in the Setting up a production deployment on Ubuntu recipe.

Getting ready

Here we assume that you have already downloaded and unzipped web2py somewhere in your home folder. We also assume that your web hosting provider has mod_proxy enabled, supports long running processes, allows you to open a port (8000 in the example but you can change if this port is occupied by another user).

How to do it...

  1. In your base web directory, create a file .htaccess, if necessary, and add these lines:

    RewriteEngine on
    RewriteBase /usr/www/users/username
    RewriteRule ^((welcome|examples|admin)(/.*)?)$ \
      $1 [P]
  2. Download and unzip web2py as described previously for CGI operation, except that web2py need not be installed in your cgi-bin directory, or even in your web documents tree. For this recipe, we'll assume that you install it in your login home directory $HOME.

  3. Start web2py running on localhost and port 8000 with the following command:

    nohup python web2py.py -a password -p 8000 -N 

    The password is the one time admin password that you choose. The -N is optional and it disables web2py cron to save memory. (Notice that this last step cannot be accomplished trhough FTP, so login access is required.)


Running web2py from a user-defined folder

This recipe explains how to relocate the web2py applications folder.

With web2py, each application lives in a folder under the applications/ folder, which in turn is located in the web2py base or root folder (the folder that also contains gluon/, the web2py core code).

When web2py is deployed using its built-in web server, the applications/ folder can be relocated to some other location in your file system. When applications/ is relocated, certain other files are relocated as well, including logging.conf, routes.py, and parameters_port.py. Additionally, a site-packages in the same folder as the relocated applications/, is inserted into sys.path (this site-packages directory need not exist).

How to do it...

When web2py is run from the command line, the folder relocation is specified with the -f option, which should specify the parent folder of the relocated applications/ folder, for example:

python web2py.py -i -p 8000 -f /path/to/apps

There's more...

When web2py is run as a Windows service (web2py.exe -W), the relocation can be specified in a file options.py in the web2py main folder. Change the default folder: os.getcwd() to specify the parent folder of the relocated applications/ folder. Here is an example of the options.py file:

import socket
import os

ip = ''
port = 80
password = '<recycle>'  # <recycle> means use the previous password
pid_filename = 'httpserver.pid'
log_filename = 'httpserver.log'
profiler_filename = None
#ssl_certificate = 'ssl_cert.pem'  # certificate file
#ssl_private_key = 'ssl_key.pem'  # private key file
#numthreads = 50 # ## deprecated; remove
minthreads = None
maxthreads = None
server_name = socket.gethostname()
request_queue_size = 5
timeout = 30
shutdown_timeout = 5
folder = "/path/to/apps" # <<<<<<<< edit this line
extcron = None
nocron = None

Applications relocation is not available when web2py is deployed with an external web server.

How to do it...

  1. First, create a web2py unprivileged user:

    sudo adduser web2py
  2. For security, disable the web2py user password to prevent remote logins:

    sudo passwd -l web2py
  3. Download the source package from web2py's official website, uncompress it in a suitable directory (for example /opt/web2py), and set the access permissions appropriately:

    wget http://www.web2py.com/examples/static/web2py_src.zip
    sudo unzip -x web2py_src.zip -d /opt
    sudo chown -Rv web2py. /opt/web2py
  4. Create an init script in /etc/inid.d/web2py (you can use the one in web2py/scripts/ as a starting point):

    sudo cp /opt/web2py/scripts/web2py.ubuntu.sh /etc/init.d/web2py
  5. Edit the init script:

    sudo nano /etc/init.d/web2py
  6. Set the basic configuration parameters:

    DAEMON_ARGS="web2py.py -p 8001 -i -c server.crt -kserver.key -a<recycle> --nogui --pid_filename=$PIDFILE -l \$APPLOG_FILE"
  7. Change and 8001 to your desired IP and port. You can use as a wildcard IP that match all the interfaces.

  8. Create a self-signed certificate, if you plan on using admin remotely:

    sudo openssl genrsa -out /opt/web2py/server.key 1024
    sudo openssl req -new -key /opt/web2py/server.key -out /opt/\web2py/server.csr
    sudo openssl x509 -req -days 365 -in /opt/web2py/server.csr \-signkey /opt/web2py/server.key -out /opt/web2py/server.crt
  9. If you use print statements for debugging purposes, or want to record web2py output messages, you can redirect standard output, by adding the following line after the imports in web2py.py:

    sys.stdout = sys.stderr = open("/opt/web2py/web2py.err","wa", 0)
  10. Finally, start your web2py service:

    sudo /etc/init.d/web2py start
  11. To install it permanently (so it starts and stop automatically with the rest of the operating system services), issue the following command:

    sudo update-rc.d web2py defaults

If all works correctly, you'll be able to open your web2py admin:

Installing web2py as a service in Ubuntu

For simple sites and intranets, you may need a simple installation method that keeps web2py running. This recipe shows how to start web2py in a simple way without further dependencies (no Apache webserver!).

There's more...

You can see what is happening using bash to debug the init script:

sudo bash -x /etc/init.d/web2py start

Also, you can change start-stop-daemon options to be more verbose, and use the web2py user to prevent interference with other Python daemons:

start-stop-daemon --start  \
 ${DAEMON_USER:+--chuid $DAEMON_USER} --chdir $DAEMON_DIR \
 --background --user $DAEMON_USER --verbose --exec $DAEMON \
 --$DAEMON_ARGS || return 2

Remember to set up a password to be able to use the administrative interface. This can be done by executing the following command (change mypass to your desired password):

sudo -u web2py python /opt/web2py/web2py.py -p 8001 -a mypasswd

Running web2py with IIS as a proxy

IIS is the primary web server for the Windows OS. It can run multiple concurrent domains and several application pools. When you deploy web2py on IIS, you want to set up a new site, and have a separate application pool for its root application. In this way, you have separate logs and ability to start/stop the application pool, independently on the others. Here we explain how.

This is the first of three recipes in which we repeat the process using different configurations. In this first recipe, we set up IIS to act as a proxy for the web2py Rocket web server.

This configuration is desirable when IIS default site is already in production with enabled ASP.NET, ASP, or PHP applications, and at the same time, your web2py sites may be under-development and may require frequent restarting (for example, due to changes in routes.py).

Getting ready

In this recipe, we assume that you have IIS version 7 or later, already installed. We do not discuss the steps to install IIS7, since it is a commercial product and they are well documented somewhere else.

You also need to have web2py unzipped in a local folder. Start web2py on port 8081.

python web2py -p 8081 -i -a 'password'

Note that when running web2py as a proxy, you should be careful about unintentionally exposing admin without encryption.

Finally, you need to be able to use a IIS Proxy. For this, you will need Application Request Routing (ARR) 2.5. ARR can be downloaded and installed from Microsoft Web Platform Installer available here:


How to do it...

  1. After you download the web platform installer for ARR, open the application and browse to Products on the left-hand side of the screen, as shown in the following screenshot:

  2. Next, click on Add - Application Request Routing 2.5, and then click on Install. This will take you to a new screen, as shown in the following screenshot; click on I Accept:

  3. Web Platform installer will automatically select and install all the dependencies required for Application Request Routing 2.5 to work. Click on Finish, and this will bring you to the Download and Installation screen.

  4. Once you receive the successful message, you can close Microsoft web platform application.

  5. Now open the IIS Manager, and create a new website as directed.

  6. First, right-click on Sites on the top-left in the IIS Manager, and select New Website. This will take you to the following screen. Fill in the details as shown here:

    Make sure you select the right IP on which your site will run.

  7. Once the site is created, double-click the URL Rewrite as shown in the following screenshot:

  8. Once in URL Rewrite module, click on Add Rule on the top-right-hand side, as shown in the next screenshot.

  9. Select the Reverse Proxy template under Inbound and Outbound Rules.

  10. Fill out the details as shown here:

  11. Since the Server IP field is the most important, it must contain the IP and port where web2py is running: Also, make sure that SSL Offloading is checked. In the outbound rules for the TO field, write the domain name assigned to the website. When done, click OK.

    At this point, everything on your web2py installation should be working, except for the admin interface. Web2py requires that we use HTTPS when a request for the admin interface is coming for a non-localhost server. In our example, localhost for web2py is, while IIS is currently operational on

  12. To enable the admin, you will need a certificate. Create a certificate and add it to your server certificates in IIS 7, then repeat the previous steps to bind 443 to the web2py website we created previously.

  13. Now, visit: https://yourdomain.com/admin/, and you will be able to browse the web2py admin web interface. Enter the password for your web2py admin interface, and proceed normally.


Running web2py with ISAPI

Here, we present a production quality configuration, which uses a dedicated application pool run natively in IIS using the ISAPI handler. It is similar to a typical Linux/Apache configuration, but is a Windows native.

Getting ready

As before you will need IIS installed.

You should have web2py already downloaded and unzipped. If you have it already running on port 8081 (or other port) on localhost, you can leave it there, since it should not interfere with this installation. We will assume web2py is installed into C:\path\to\web2py.

You can place it anywhere else you like.

Then you need to download and install isapi-wsgi. This is explained below.

How to do it...

  1. First of all, you need to download isapi-wsgi from: http://code.google.com/p/isapi-wsgi/.

    It is a mature WSGI adapter for IIS, based on pywin32. Most of this recipe is based on the documentation and the examples about isapi-wsgi.

    You can install isapi-wsgi using the win32 installer: http://code.google.com/p/isapi-wsgi/downloads/detail?name=isapi_wsgi-0.4.2.win32.exe.

    You can also install it simply downloading the Python file somewhere into "c:\Python\Lib\site-packages"


    isapi_wsgi runs on IIS 5.1, 6.0, and 7.0. But IIS 7.x must have IIS 6.0 Management Compatability installed.

    You may want to try running the following test to see that it was installed properly:

    cd C:\Python\Lib\site-packages
    C:\Python\Lib\site-packages> python isapi_wsgi.py install
    Configured Virtual Directory: isapi-wsgi-test
    Extension installed
    Installation complete.
  2. Now go to http://localhost/isapi-wsgi-test/.

  3. If you get a 500 error that says this is not a valid Win32 application, then something is wrong and this is discussed here: http://support.microsoft.com/kb/895976/en-us.

  4. If you see a normal Hello response, then the installation was successful, and you can remove the test:

    C:\Python\Lib\site-packages> python isapi_wsgi.py remove

    We are not yet ready to configure the web2py handler. You need to enable the 32-bits mode.

  5. We are now ready to configure the web2py handler. Add your web2py installation to the PYTHONPATH:

    set PYTHONPATH=%PYTHONPATH%;C:\path\to\web2py
  6. If it does not exist already, create the file isapiwsgihandler.py in the C:\path\to\web2py folder, which contains the following:

    import os
    import sys
    import isapi_wsgi
    # The entry point for the ISAPI extension.
    def __ExtensionFactory__():
      path = os.path.dirname(os.path.abspath(__file__))
      sys.path = [path]+[p for p in sys.path if not p==path]
      import gluon.main
      application = gluon.main.wsgibase
      return isapi_wsgi.ISAPISimpleHandler(application)
    # ISAPI installation:
    if __name__=='__main__':
      from isapi.install import ISAPIParameters
      from isapi.install import ScriptMapParams
      from isapi.install import VirtualDirParameters
      from isapi.install import HandleCommandLine
      params = ISAPIParameters()
      sm = [ScriptMapParams(Extension="*", Flags=0)]
      vd = VirtualDirParameters(Name="appname",Description = "Web2py in Python",ScriptMaps = sm,
        ScriptMapUpdate = "replace")
      params.VirtualDirs = [vd]

    Recent versions of web2py may already contain this file, or even a better version.

  7. The first part is the handler, and the second part will allow an automatic installation from the command line:

    cd c:\path\to\web2py
    python isapiwsgihandler.py install --server=sitename

    By default, this installs the extension for virtual directory appname under Default Web Site.

There's more...

Check the current mode for Web Applications (32 bits or 64 bits):

cd C:\Inetpub\AdminScripts
cscript.exe adsutil.vbs get W3SVC/AppPools/Enable32BitAppOnWin64
cscript %systemdrive%\inetpub\AdminScripts\adsutil.vbs get w3svc/\AppPools/Enable32bitAppOnWin64

If answer is The parameter "Enable32BitAppOnWin64" is not set at this node or Enable32BitAppOnWin64 : (BOOLEAN) False, then you must switch from 64 bits to 32 bits mode for the Web Server. ISAPI does not wok on IIS in 64 bits mode. You can switch with the command:

cscript %systemdrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/\AppPools/Enable32bitAppOnWin64 1

Then restart application pool, as follows:

IIsExt /AddFile %systemroot%\syswow64\inetsrv\httpext.dll 1 ^WEBDAV32 1 "WebDAV (32-bit)"

Or set up a separate pool, as follows:

system.webServer/applicationPool/[email protected]

About the Authors

  • Mariano Reingart

    Mariano Reingart lives in Buenos Aires (Argentina), and is a specialist in database administration, and development of software applications and libraries (web services, PDF, replication, and so on), with more than 10 years of experience. Currently, he is the PostgreSQL regional contact for Argentina and a web2py contributor, with more than 14 open source projects, including interface for Free Electronic Invoice web services (PyAfipWs) and Pythonic Replication for PostgreSQL (PyReplica). Mariano has a bachelor's degree in Computer Systems Analysis from the University of Morón, and currently works on his own funded startup formed by an open group of independent professionals, which is dedicated to software development, training, and technical support, focusing on open source tools (GNU/Linux, Python, PostgreSQL and web2py). Mariano has worked for local Python companies in large business applications (ERP, SCM, and CRM) and mission critical systems (election counting, electronic voting, and 911 emergency events support). He has contributed to the book web2py Enterprise Web Framework 3rd Edition, and for several Spanish translation efforts of the PostgreSQL official documentation. You can find his resume at: http://reingart.blogspot.com/p/resume.html.

    Browse publications by this author
  • Bruno Cezar Rocha

    Bruno Cezar Rocha is a web developer and entrepreneur. He is the co-founder and lead developer at http://www.blouweb.com, a micro-company dedicated to web2py/Python web development and training. He is the lead teacher in Curso de Python (http://www. CursoDePython.com.br), an initiative to offer online courses of Python and web2py to Brazilian companies and educational institutes. He is the Vice President of the Python Brazilian Association, which is the organizer of PyCon Brazil, and other Python-related events in his country. He is an entrepeneur focused on SaaS products powered by web2py at http://www.ansy.me/en, which is a pioneer in web-based systems for veterinarians and pet shops, and creator of http://www.movu.ca, a social network engine and CMS powered by web2py. You can find his resume at: http://www.rochacbruno.com.br

    Browse publications by this author
  • Jonathan Lundell

    Jonathan Lundell leveraged a background in the philosophy of Ludwig Wittgenstein, into an exciting career in computer systems design. These days, he uses web2py to provide cloud services to his iOS apps, written for Lobitos Creek. He's getting used to Objective-C, but can't help wishing that Steve Jobs had been a Python fan.

    Browse publications by this author
  • Pablo Martin Mulone

    Pablo Martín Mulone is a full-time web developer and software designer. He co-runs his own company located in Argentina, which is dedicated to bring IT solution to libraries, archives, and government in matter of documentary preservation. He has an extensive experience in FLOSS projects and associated tools. He is the creator of instant2press and CMS/ blog that is developed in web2py framework. His company created the patrimoniosf. gov.ar heritage database, which was built for the state government of Santa Fe.

    Browse publications by this author
  • Michele Comitini

    Michele Comitini is a programmer, a consultant, and an entrepreneur, with 20 years of experience in the field of open source software development. Michele has worked with many of the top Information and Communication Technology (ICT) companies in Italy. His skills include the ability to program in many languages and some of the most popular web frameworks. Michele was a Linux early adopter, and he has developed a deep knowledge of the Linux/Unix operating systems as well as its use in embedded systems. Michele is the owner and CEO of GliscoS.R.L., a consulting and development firm that is specialized in mission critical or highly customized software. His customers are mostly companies in the ICT and in the financial sectors.

    Browse publications by this author
  • Richard Gordon

    Richard Gordon has 30 years of experience in agile web development and industrial design-automation software. He has a Master's degree in Electrical Engineering from Stanford University and a Science Baccalaureate with honors from Brown University. His career spans microprocessor design at AT&T Bell laboratories, electronic-design-automation, software development at Mentor Graphics and Tera Systems, which he founded. He is the founder and lead YAK at YAKiToMe! Co., the Internet's first text-to-speech SaaS portal.

    Browse publications by this author
  • Massimo Di Pierro

    Massimo Di Pierro is an associate professor at the School of Computing of DePaul University in Chicago, where he directs the Master's program in Computational Finance. He also teaches courses on various topics, including web frameworks, network programming, computer security, scientific computing, and parallel programming. Massimo has a PhD in High Energy Theoretical Physics from the University of Southampton (UK), and he has previously worked as an associate researcher for Fermi National Accelerator Laboratory. Massimo is the author of a book on web2py, and more than 50 publications in the fields of Physics and Computational Finance, and he has contributed to many open source projects. He started the web2py project in 2007, and is currently the lead developer.

    Browse publications by this author

Latest Reviews

(3 reviews total)
Seriously outdated-- some of the core concept (objects and syntax) don't match up to the current release of Web2py which leads me to give it only 2 out of 5. But I will buy the book again when the author gets around to writing a new edition.
O livro é um excelente guia para quem está iniciando com o desenvolvimento web com o framework web2py.
excellent service, fast and efficient