Skip to content

[feature] Django SECRET_KEY: secrets should be used in preference to the default pseudo-random number generator in the random module #563

@cbeaujoin-stellar

Description

@cbeaujoin-stellar

Is your feature request related to a problem? Please describe.
The current generate_django_secret_key.py used by the ansible script, does not follow best practice.

Describe the solution you'd like
I would like to use the secrets python library instead random lib.

Describe alternatives you've considered
No special alternative, according to https://docs.python.org/3/library/secrets.html it seems to be best practice.
It's also used in other well known project (e.g: https://github.com/netbox-community/netbox/blob/main/netbox/generate_secret_key.py)

Additional context
No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions