How to install web.py


In this article we will learn how to learn how to install web.py under Linux / UNIX environments.

 

What is Web.py and why use it?

Web.py is a web application framework based on python that stresses minimalism, flexibility, scalability, rapid application development, and is a very easy straight forward deployment.

Web.py was originally developed to power a very popular news and link aggregation website called “Reddit”. Web.py is a powerful option and a good choice for developing systems for the web.

 

Before we begin installation web.py (on our Debian based operating system Ubuntu 12.04 LTS), you need to make sure that your hostname is correctly setup.

 

Note: This works under Ubuntu 10.04 LTS, Ubuntu 13, Debian 6 and Debian 7.

 

If you don’t know on how to set your machine hostname, please refer to our previous KB article, “How to set the hostname of a machine”

 

In this case, our hostname is “example.com”

 

First, update your operating system’s repositories and then upgrade the packages installed. Please note we are running all commands from a sudo enabled user.

 

sudo apt-get update

sudo apt-get upgrade

 

 

Now install Apache web server and python.

 

sudo apt-get install apache2 python

 

Your web.py application may require additional packages or dependencies we recommend to install below packages.

 

sudo apt-get install python-psycopg2 postgresql

 

The above command will also install postgres database. You may use a simple relational database like sqlite by using the commands below.

 

sudo apt-get install python-pysqlite2 sqlite3

 

Now, let’s move on the part of installation of web.py on our machine.

If you want a simple, fast and easy install, you may use the command below to download and install from the apt-get repositories.

 

sudo apt-get install python-webpy

 

However, we always look for latest stable releases. We also demonstrate on how to download, compile and install web.py from a tarball source code.

 

cd /opt/

wget http://webpy.org/static/web.py-0.37.tar.gz

tar xvzf web.py-0.37.tar.gz

cd /opt/web.py-0.37/

sudo python setup.py install

 

If you would like to download, compile and install from GIT repositories ―which is very good and helps with easy upgrades― follow the procedure below.

 

sudo apt-get install git-core

cd /opt/

git clone git://github.com/webpy/webpy.git

cd /opt/webpy/

sudo python setup.py install

 

When you want to upgrade to the latest development version of web.py, follow the commands below:

 

cd /opt/webpy/

git clean -f

git pull

sudo python setup.py install

 

That’s it, you have successfully installed web.py on your machine!

You can refer to our article on “How to deploy web.py applications,” to test and run your web.py application.

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)