'How to securely generate random passwords in Django?

I have imported a set of user data into a Django project. Now I need to set a random password for each of them.

My question here is, how do I securely generate random passwords in Django?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source