Category Archives: Hello World

Python, Bottle and websockets

Here is a simple websockets demo, using Python and Bottle, based on the example on the Bottle website

  1. Requirements:
    • pip install bottle
    • pip install python-dev
    • pip install gevent-websocket
  2. Create, from the source code at
  3. python
    • This starts the (websockets) server. Note that it doesn’t show any output
  4. Create websockets.html, again from
    • Make sure to change the websocket address (from “ws://”). On your local machine this should be “ws://localhost:8080/websocket”
  5. Load websockets.html in your browser (e.g. as a local file, at file:/// etc)
    • This should come up with an alert saying: Your message was ‘Hello, world’

Django – Hello World


  1. easy_install, pip, virtualenv – getting ready for Django
  2. Installing Django

Hello World project in <dev root>/Projects/HelloWorldDjango

  1. Switch to <dev root>/Projects
  2. startproject HelloWordDjango (create the basic project files)
  3. cd HelloWorldDjango
  4. Check if it works so far: python runserver (start the test server)
  5. Ctrl-C to stop the test server
  6. Create the view: In <dev root>/Projects/HelloWorldDjango/HelloWorldDjango, create a file called “” with the following content:
    from django.http import HttpResponse

    def hello(request):
    return HttpResponse(“Hello world”)

  7. Set the URL:
    1. In <dev root>/Projects/HelloWorldDjango/HelloWorldDjango/, add the following to the import line:
      from HelloWorldDjango.views import hello
    2. In the same file, add the following to the urlpatters list:
      (‘^hello$’, hello),
  8. Start the test server: in <dev root>/Projects/HelloWorldDjango, python runserver
  9. In your browser go to http://localhost:8000/hello. This should show you “Hello world”