django1/django/core/management/commands/startproject.py

21 lines
688 B
Python
Raw Normal View History

from django.core.management.templates import TemplateCommand
from ..utils import get_random_secret_key
class Command(TemplateCommand):
2016-03-29 06:33:29 +08:00
help = (
"Creates a Django project directory structure for the given project "
"name in the current directory or optionally in the given directory."
)
missing_args_message = "You must provide a project name."
def handle(self, **options):
project_name = options.pop('name')
target = options.pop('directory')
2014-05-22 18:19:54 +08:00
# Create a random SECRET_KEY to put it in the main settings.
options['secret_key'] = get_random_secret_key()
super().handle('project', project_name, target, **options)