I wrote an ansible-role for openwisp2 to ease its deployment, it\'s a series of django apps. To ease the deployment as much as possible, I wrote a simple (probably trivial)
Indeed, you can use the same function that generates a new key when you call startproject
, which is django.core.management.utils.get_random_secret_key().
Note however it's not very different from your version.
For lazy people like me:
from django.core.management.utils import get_random_secret_key
get_random_secret_key()