Archive

Archive for the ‘python’ Category

Automatic setup of Django 1.4, NGinx and GUnicorn on EC2 using Bellatrix

April 2nd, 2012 No comments


Some time ago I wrote some lengthy instructions on how to configure Django, NGinx and Green Unicorn on an brand new Ubuntu EC2 instance. Now, I want to show how to automate the same tasks using a command line tool called Bellatrix. We will also provide a Jenkins (formerly Hudson) pipeline so we have, if we want, a nice display for the UI.

Read more…

Setting up Django 1.3 + NGinx 1.0.5 + Green Unicorn 0.13 in an Ubuntu 11.10 EC2 instance

December 27th, 2011 34 comments

Django has become the de-facto web framework for Python. Although, since Django just specializes in dynamic content, you have to combine it (at least in production) with an HTTP server to serve static content such as css, javascript files and images files. In the past, the communication protocol between Python web applications was CGI, FastCGI or mod_python. But after PEP-333 was accepted the faster and more efficient WSGI became the standard.

Green Unicorn is a Python WSGI HTTP Server for UNIX. Its combination with the high performance HTTP server NGinx is gaining lot of momentum in the Python community.

From “man gunicorn”…

Green Unicorn (gunicorn) is an HTTP/WSGI server designed to serve
fast clients or sleepy applications. That is to say; behind a
buffering front-end server such as nginx or lighttpd.

 

We are describing here how to combine a Django application with Green Unicorn and Nginx within a pristine EC2 Ubuntu 11.10 image.
Read more…

Getting reTweets from Python

September 22nd, 2010 1 comment

In this snippet I will show how to use the Tweepy library to get statistics from Tweeter.

The script will read a sample feed from the Twitter Streaming API (http://dev.twitter.com/pages/streaming_api) and perform the following actions:

* Reads the sample feed
* Notes the number of retweets seen
* Tracks the number of times posts have been retweeted, and
* Produces an hourly report of the 20 most frequently retweeted posts

Read more…