Adapting manage.py to work with newer Django versions