Fixed Python3 compatibility
Configurable constants from settings.py