Fun with WebSocket: Setting up a shared drawing board

Posted in Python by

Three weeks ago we added support for WebSocket to our platform. WebSocket is a protocol providing full-duplex communications channels over a single TCP connection. It means that multiple clients can stay connected to a server and they can communicate back and forth much quicker than with the standard HTTP protocol.

One case where WebSocket is useful is when the changes made by one client need to be instantly broadcasted to the other clients.

As an example we’ve set up a shared drawing board web app where multiple people can draw on the same canvas at the same time. The tools we used are:

  1. A hosting account that supports WebSocket and Python
  2. The CherryPy Python web framework
  3. The WebSocket for Python library
  4. The jCanvas javascript library (built on top of jQuery)
  5. 300 lines of Python code for the web app itself

The source code for the drawing board is included as an example in the WebSocket-for-Python library and you can try the demo at

Here is a short video showing the drawing on one device being instantly displayed on another device (after travelling via the server which was hundreds of miles away):

Click here to view the video


Busy October and a $50 credit for all new services ordered

Posted in Django by

As you may have noticed October has been a busy month for WebFaction:

To finish the month in style we are giving a $50 credit for all new services ordered before October 31st at midnight UTC:

New customers: just sign up between now and October 31st, pay $9.50 for the first month (or pay for longer) and enter the promo code “BUSYOCTOBER”. $50 will automatically be credited to your account.

Existing customers: add one new service to your account (or upgrade an existing service) between now and October 31st, pay for one month of that service and mention the promo code “BUSYOCTOBER”. A $50 credit will be automatically added to your account. You need to keep the new service for at least 6 months to keep the credit.

Each customer is limited to one credit only, and it is non-transferable and non-refundable.

Here is to a great October and many more great months to come!


New one-click installer: Django and Python 3

Posted in Django by

Today we’re introducing a new installer and we think this one is pretty special. You can now install Django 1.5 running on Python 3.3. The team at WebFaction is excited to be an early Python 3 adopter by becoming one of the first hosts to support Django on Python 3.

If you’re a Python user, you know that the transition from Python 2 to Python 3 hasn’t happened overnight. In fact, the first Python 3 release happened almost five years ago. The pace of transition has been influenced by a kind of chicken or the egg problem: Python users have been reluctant to upgrade because few libraries supported Python 3, but library maintainers (and web hosts) have been reluctant to upgrade because of few Python 3 users. But that’s starting to change with Python 3 support appearing in popular libraries such as Requestsnose, and now Django.

With Django on Python 3.3, you get all the new benefits of Python 3 which were not backported to Python 3 (check out the “What’s New” documentation for Python, and 3.3 for complete details). For example, if you’ve ever needed to do something like this with a generator in Python 2 code:

for elem in some_iterable:
    yield elem

You can now simplify that code using Python 3.3’s yield from syntax:

yield from some_iterable

Before you dash headlong into upgrading your Django sites, please exercise some caution. The Django project considers Python 3 support to be experimental, so the current Django release comes with a few limitations. Notably, MySQL with Python 3 is unsupported. Additionally, while many libraries have added Python 3 support, support for the new language version is far from universal, so be sure to investigate your dependencies (including pluggable Django applications) before upgrading.

If you’re ready to give Django on Python 3 a whirl, give the installer a try with the WebFaction control panel. And if you run into problems with the new installer, join us in the Q&A Community.


One-click installers: Python web frameworks

Posted in Python by

This post is the first in a series taking a closer look at the variety of one-click installers available with the WebFaction control panel. Today, we’re starting close to our Python roots, by taking a look our Python web application tool belt.

We have one-click installers for several popular ways of building a web application with Python: CherryPy, Django, Pyramid, TurboGears, Zope and Plone, and mod_wsgi:


CherryPy is an object-oriented web framework that affords flexibility when it comes to choosing templating, database interaction, and more. CherryPy has a long history with WebFaction, as the control panel and API started out as CherryPy applications.


Django is far and away the most popular Python one-click installer, and it comes as no surprise, thanks to its “batteries included” approach, extensive documentation, and enormous ecosystem of pluggable apps. Django’s all-in-one package includes a database ORM, a templating engine, and an administration interface.

See the WebFaction Django docs for a “getting started” guide and various configuration and troubleshooting sections.


Pyramid, fomerly known as repoze.bfg, is a web framework that’s often discribed as “minimalist.” Much like CherryPy, or in contrast to Django, Pyramid makes few assumptions about what components your web application might use, such as templating engines or databases.

See the WebFaction Pyramid docs for a deployment example, and a couple of WebFaction-specific Pyramid instructions.


TurboGears brings together several separate libraries to form a web framework. For example, TurboGears uses SQLAlchemy, a Python SQL toolkit, to provide persistence with a database, or Genshi for templating.

See the WebFaction TurboGears docs for a deployment example.

Zope and Plone

Zope is an object-oriented web application coupled with a unique persistence layer, the Zope Object Database, that stores actual Python objects. Plone is a comprehensive content management system that runs on Zope. The one-click installer provides both, but creating a Plone site is optional.

See the WebFaction Zope and Plone documentation for instructions on setting up a Plone site, and detailed Zope and Plone administration tasks.


WSGI, the Web Server Gateway Interface, is a standard interface for Python web applications (as defined in PEP 333). WSGI provides a common way for Python web applications to communicate with web servers. Most Python web frameworks you know and love are WSGI compatible. mod_wsgi is a module that adds WSGI support to the Apache web server.

The mod_wsgi one-click installer provides an Apache server with mod_wsgi installed and configured. The mod_wsgi one-click installer is especially handy for situations where you want to use a WSGI-compatible framework that doesn’t already have a one-click installer, like Flask and Bottle, or something of your own creation.


Python has a broad and capable family of web frameworks, so there’s sure to be one that has the features or characteristics you need. If one of these tools has piqued your interest, try its one-click installer. If you need any help, join us in the Q&A Community.


Django 1.5 is here!

Posted in Python by

Today, the latest version of Django has been released. And we’re happy to make it available to you with the new Django 1.5 one-click installer:

Screen shot 2013-02-26 at 3.14.47 PM

Django 1.5 brings with it several major improvements, including:

  • A customizable user model. Now you can use you own model to store information about your users. Use it to ditch that 30-character username restriction, or to store first name and last name together in a single field.
  • The verbatim template tag. It turns off Django’s templating between the tags. Handy for using some JavaScript libraries, for example.
  • Experimental Python 3 support. Now you can start testing your Django application with Python 3, to prepare for the future of Python. Production-ready status will be here before you know it, when Django 1.6 is released.

Django 1.5 has a slew of other changes, too. Check out the Django project’s release announcement and release notes (mind those backwards incompatible changes), then give the new one-click installer a test drive. Let us know what you think in the comments and, if you have any questions, join us in the Q&A Community.


Django-1.4 is here!

Posted in Python by

Today, the latest and greatest version of Django has been released. And we’ve tried to waste no time making it available to you with the new Django 1.4 one-click installer:

Django 1.4 one-click installer screenshot

The most prominent new feature of Django 1.4 is time zone support. Django can now store dates and times in a time zone-aware way. Now dates and times can be converted to visitors’ local time zone in templates and forms automatically. This feature is likely to help many developers avoid time zone pitfalls, including daylight saving time transitions often observed this time of year.

Other new developments include:

Of course, that’s not all. For more details, check out the Django 1.4 release notes. Give the new installer a try. If you have any questions, join us in the Q&A Community.


New Python-2.7 and Python-3.1 versions

Posted in Python by

Python-2.7.1 and Python-3.1.3 were released on Saturday and we’ve now rolled them out to all servers.

Also, in case you missed the announcement WordPress-3.0.2 was released on Tuesday and it contains some security fixes so everybody with a WordPress site should run the auto-upgrade asap.


A look at our Python setup

Posted in Python by

You may not know this but WebFaction started as a specialized Python hosting provider (it was even called so as you might expect we have pretty good support for Python. Let’s SSH into one of our servers and take a look:

[remi@web150 ~]$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

“What?” you say. “Only Python 2.4! My grandmother is younger than that!” (or alternatively, “Wow, this is awesome, my current host only has Python 2.2”)
Don’t worry, that’s just the default Python on Centos5. Let’s try something else:

[remi@web150 ~]$ python<hit tab>
python            python2.5-config  python2.7-config  python3.1-config
python2           python2.6         python3.0
python2.4         python2.6-config  python3.0-config
python2.5         python2.7         python3.1
[remi@web150 ~]$

That’s better… We actually have all versions from Python 2.4 to 3.1 and you can bet that we’ll add new versions as soon as they come out.
That’s just the beginning. Python comes with “batteries included” but most people need some extra modules that don’t come with Python. Let’s see what we’ve got:

[remi@web150 ~]$ rpm -qa | egrep 





[remi@web150 ~]$

That’s a pretty decent set of modules for each Python version. The “.el5.webfaction” at the end of the RPM name is our naming scheme for software we build and maintain ourselves because it’s not provided by Centos5.
But that’s not all: if you need a module which is not pre-installed we give you all the tools to install it yourself in your home directory and it’s all nicely documented at You can install them with pip, or easy_install. For example:

[remi@web150 ~]$ mkdir -p ~/lib/python2.5
[remi@web150 ~]$ easy_install-2.5 matplotlib
Searching for matplotlib
Best match: matplotlib 0.91.1
<lots of compilation messages>
[remi@web150 ~]$ python2.5
Python 2.5.4 (r254:67916, Aug  5 2009, 12:42:40)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib

Pretty cool huh?

I hope you now have a good idea of what our Python setup includes. In future blog posts we’ll look at other components of our setup.