fix django 1.7 errors, refactor settings
add django 1.5 support