You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

startproject.py 688B

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