Django-nonrel + VirtualEnv + uWSGI + Nginx + ImportError: No module named wsgi

If your uWSGI configuration is causing the below error to be displayed in the logs:

from django.core.wsgi import get_wsgi_application>
ImportError: No module named wsgi

Check if you are using Django 1.3 or below. If yes, confirm if the below lines are listed in your file:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Continue reading “Django-nonrel + VirtualEnv + uWSGI + Nginx + ImportError: No module named wsgi”


Is there a easier mechanism to parse arbitrary date strings in several different formats in Python?

I was in-need of parsing a date string value returned by PostgreSQL into something that can be manipulated in Python. After several hours of searching, I found a mechanism to accomplish this and have documented it here to help others who may encounter a similar situation in future.

# Install the python-dateutil library.

# In virtualenv environments:
pip install python-dateutil

# If you prefer to install system wide:
sudo pip install python-dateutil

# If you are using Ubuntu or an Ubuntu derived OS:
sudo apt-get install python-dateutil

# After installation, fire up the Python terminal and import dateutil parser.

>>>from dateutil.parser import parse
>>>parse("2012-08-16 14:25:05.265739")
datetime.datetime(2012, 8, 16, 14, 25, 5, 265739)

# The parse command converted the date time string into a valid datetime object.

Checkout for more examples.


Installation of psycopg2 fails within virtualenv folder in Ubuntu 12.04 – how do I fix this?

Recently, when I attempted to install the PostgreSQL adapter for Python ( psycopg2 ), in a virtualenv folder in Ubuntu 12.04, it failed. Upon attempting several solutions, I have boiled down to a fix that worked and decided to document it in an effort to help others resolve similar issue.

# Install the PostgreSQL development files (if you haven't installed them already).
sudo apt-get install postgresql-server-dev-all

# Install other required libraries
sudo apt-get install libpq-dev python-dev

# Attempt installation of psycopg2 within the virtualenv folder.
source /bin/activate
pip install psycopg2

# The installation of psycopg2 should proceed smoothly by now. If it still fails, try installing the postgresql-client libraries.
sudo apt-get install postgresql-client-common

# Attempt installation of psycopg2 again and hopefully it should work without issues.


How to install Cassandra in Ubuntu Server 12.04?

Installation of Cassandra in the Ubuntu Server 12.04 can be performed in multiple ways. In this article, I will focus on utilizing the ‘apt-get’ command line utility to install ‘Cassandra’. This information is also documented at the ‘Cassanda Wiki’.

Please note that its recommended to have ‘Oracle JDK at-least version 6’ installed in the machine before installing Cassandra.

Step 1: Add the required repositories.

sudo echo "deb 11x main" >> /etc/apt/sources.list;
sudo echo "deb-src 11x main" >> /etc/apt/sources.list

Step 2: Update.

Continue reading “How to install Cassandra in Ubuntu Server 12.04?”

How to fix the Django error displayed when loading Twissandra for the first time?

Twissandra is a beautiful example project that can be used to learn the features of Cassandra. Its maintained by ‘Tyler Thobbs’. Please see for more details on the Twissandra project.

This article attempts to provide a solution for the Django error that is displayed when you complete all the steps listed at the Twissandra GitHub Readme document and attempt to visit the Twissandra site for first time. When I came across this issue for the firs time, a through research on the solution led me to the fix posted at :Tod (Play Cassandra).

Error reported by the web page:

Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'"

One of the possible solution:

Continue reading “How to fix the Django error displayed when loading Twissandra for the first time?”