Is there a function for generating settings.SECRET_KEY in django?

后端 未结 2 851
礼貌的吻别
礼貌的吻别 2021-01-17 08:12

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)

相关标签:
2条回答
  • 2021-01-17 08:47

    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.

    0 讨论(0)
  • 2021-01-17 08:49

    For lazy people like me:

    from django.core.management.utils import get_random_secret_key  
    get_random_secret_key()
    
    0 讨论(0)
提交回复
热议问题