Python Web Framework Series – Pylons: Part 1 Getting Started

This article assumes you have Python 2.6 and Setuptools already installed on your machine and that you’re install SQL Alchemy 0.54 and Pylons 0.97


Pylons is a component based MVC web framework. It, like a lot of more recent MVC frameworks, is borrowing some ideas and concepts from rails  in a less “opinionated “ way.

Out of the box Pylons has a preference for using SQL Alchemy for ORM (similar to NHibernate in philosophy) and Mako template engine (uses Python code for markup) .  Now if you prefer SQLObject , or the Elixer dialect of SQL Alchemy for ORM and Genshi template engine pylons supports them all (and others).  More importantly this means you have choice down the road to match your personal preferences or particular project complexity needs.



With Setuptools installed Pylons installation is type the following in a command prompt:

<i>easy_install Pylons</i>

<i>easy_install SQLAlchemy</i> 

This will install everything needed to get started.

Pylons Forum

Were going to create a simple forum called Pylons Forum. Not exactly imaginative, but it requires authorization, db calls, and basic view logic. Just be glad its not a shopping cart or blog.


paster create –list-templates

Picture 1

We’re going to use the pylons template for now and type

paster create –t pylons pylonsforum

 Picture 2


select enter to pick ‘mako’, then you’ll see:

 Picture 4



type in true then hit enter.

cd into the pylonsforum directory and run dir(or ls depending on your platform)

should result in:

Picture 5

Now if this is what you see the key being “development.ini” file. Type

paster serve –reload development.ini

Picture 11

open up a browser to


Picture 8


First Controller and Test

Now that we have our structure setup go ahead and type the following:

cd pylonsforum

paster controller home


you should see:

Picture 12

So we’ve created a controller and a functional test associated with that controller.

open the following url:


will bring up the obligatory “hello world”.

Next post I’ll being to cover using controllers and views.

About Ryan Svihla

I consider myself a full stack polyglot, and I have been writing a lot of JS and Ruby as of late. Currently, I'm a solutions architect at DataStax
This entry was posted in Pylons, Python. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • This is great – thanks for the blog post and I look forward to seeing more on this topic.

    What database are you using?

  • Which Setuptools did you use – I’m not seeing a windows installer for the 2.6 python, just 2.5 ?

    Maybe I should ask this: is there a good ‘setup for dummies’ tutorial that would walk through the setup steps for what you are using ?

    The setup sometimes is more painful than using the software :)

  • let me give you the concattenated version.

    For setuptools downloading from source, unzipping and running. Assuming you have python.exe in your path

    1) cd into the directory you extracted the source
    2) look for
    3) python install

    let me know if you have issues.

  • Greg

    Just a quick typo in need of correction…

    “paste controller home”

    should be:

    “paster controller home”

  • Nice catch Greg, text has been corrected and thank you.

  • Mike

    Will you be looking at any other frameworks. I’ve been playing with web2py and would be interested in your opinion.

  • @Mike
    If the interest in this continues and the feedback is good I plan on doing GAE development with Pyxer, and then Django.

    I’ll take a look at web2py and see if there is something interesting for me to dive into.

    Thanks for the tip.