Refactor to a django app