Fixed the addapp management command to be compatible with Python 3