Debian Codegraph @

django/core/management/commands/startproject.py

raw
1 from django.core.checks.security.base import SECRET_KEY_INSECURE_PREFIX
2 from django.core.management.templates import TemplateCommand
3
4 from ..utils import get_random_secret_key
5
6
7 class Command(TemplateCommand):
8 help = (
9 "Creates a Django project directory structure for the given project "
10 "name in the current directory or optionally in the given directory."
11 )
12 missing_args_message = "You must provide a project name."
13
14 def handle(self, **options):
15 project_name = options.pop("name")
16 target = options.pop("directory")
17
18 # Create a random SECRET_KEY to put it in the main settings.
19 options["secret_key"] = SECRET_KEY_INSECURE_PREFIX + get_random_secret_key()
20
21 super().handle("project", project_name, target, **options)