Setting up Pyramid on Ubuntu

Recently I have been getting into more Python and have been using the Pyramid framework. Pyramid is a micro framework for Python kind of like Sinatra for Ruby.

So here is a quick guide showing you how to set up Pyramid on an Ubuntu 11.10 base install in only 6 steps.

1 First thing to do is make sure that python setup tools are installed.

$ sudo apt-get install python-pip python-dev build-essential

2 Next we want to install virtualenv as we will keep all our packages in their own virtual environment.

$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv

3 Create your home directory and cd into it.

$ mkdir PROJECT_NAME
$ cd PROJECT_NAME

4 Create a virtual environment and activate it.

$ virtualenv env
$ source env/bin/activate

5 Install pyramid framework and start an empty pyramid project.

$ env/bin/pip install pyramid
$ env/bin/pcreate -s starter PROJECT_NAME

6 Go into the projects folder. Run the set up script and run the website using Pyramids own little server.

$ cd PROJECT_NAME
$ ../env/bin/python setup.py develop
$ ../env/bin/pserve development.ini

Once you have done that it will return the IP and Port that it is running the webserver on and you use that in the browser. THAT IS IT!

Comments !

social