configurated and modified for django 1.5