File: generate_secret_key.py

package info (click to toggle)
python-django-extensions 4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,812 kB
  • sloc: python: 18,601; javascript: 7,354; makefile: 108; xml: 17
file content (17 lines) | stat: -rw-r--r-- 484 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-
from typing import List

from django.core.management.base import BaseCommand
from django.core.management.utils import get_random_secret_key

from django_extensions.management.utils import signalcommand


class Command(BaseCommand):
    help = "Generates a new SECRET_KEY that can be used in a project settings file."

    requires_system_checks: List[str] = []

    @signalcommand
    def handle(self, *args, **options):
        return get_random_secret_key()