Install web2py Web Framework

This article illustrates how to install Web2py

Web2Py is a"Free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python"

Download from Web2py download page the Source code:

~# wget http://www.web2py.com/examples/static/web2py_src.zip

and unzip it:

~# unzip -a web2py_src.zip

If you don't have unzip install it:

~# apt-get update
~# apt-get install unzip

Move inside the just created web2py directory and launch web2py:

~# cd web2py
~/web2py# python web2py.py -a 'AdminPwd' --ip 0.0.0.0
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2007
Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)
please visit:
    http://127.0.0.1:8000/
use "kill -SIGTERM 2400" to shutdown the web2py server

Open a browser and access to the web2py embedded web server from this url:

Due to security reasons, the web2py admin application is not usable on an insecure channel so we have to use https instead of http protocol using openssl.

Using Web2py in https

Install openssl:

~# apt-get update
~# apt-get install openssl

Start by generating a certificate files, if you don't have them already:

~# openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long modulus
..........................................................+++
..........................................................+++
e is 65537 (0x10001)

~# openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IT
State or Province Name (full name) [Some-State]:Rome
Locality Name (eg, city) []:Ladispoli
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

~# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
...

Copy the server.key and server.crt files to your web2py root folder.

~# cp server.key web2py
~# cp server.crt web2py

Then start the web2py application using the certificate files:

~# cp web2py
~/web2py# python web2py.py -a 'AdminPwd' -c server.crt -k server.key -i 0.0.0.0 -p 8000

Open a browser and access to the web2py embedded web server in https from this url:

Now it is possible to access to the Administrator page

License

web2py is copyrighted by Massimo Di Pierro. The web2py trademark is owned by Massimo Di Pierro.