1👍
django has a pluggable authentication system with a concept of different backends. django comes with two backends; one that uses the database and the other that can use an external user system.
Taking advantage of this flexibility is django-auth-ldap, a custom backend designed to work with a LDAP directory. Its a drop-in replacement.
You set it up and then it will automatically populate the user groups and can also do other things (see the documentation for more information).
The example configuration details most of the configuration and setup details.
As a final tip, considering offloading the restarting of the servers. Otherwise should there be a network issue or other delay, your application won’t be blocked. To schedule tasks offline from django, use celery.