Fix for ConceptNet error “Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined”

If you’re using ConceptNet and you see:

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

then the fix is simple (I’ve been hacking away at an idea whilst at IUI2010 – thanks Rob for the fix).

To replicate the error run:

from csc.nl import get_nl
en_nl = get_nl('en')
en_nl.is_stopword('the')

The fix is to run:

import csc.conceptnet.models

which sets up Django, the call is_stopword again and all is fine.


Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.