2011-12-23 06:38:02 +08:00
|
|
|
from django.core.management.templates import TemplateCommand
|
2015-04-18 16:09:41 +08:00
|
|
|
|
|
|
|
from ..utils import get_random_secret_key
|
2011-12-23 06:38:02 +08:00
|
|
|
|
2007-08-16 14:06:55 +08:00
|
|
|
|
2011-12-23 06:38:02 +08:00
|
|
|
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."
|
|
|
|
)
|
2014-06-07 04:39:33 +08:00
|
|
|
missing_args_message = "You must provide a project name."
|
2007-08-16 14:06:55 +08:00
|
|
|
|
2014-06-07 04:39:33 +08:00
|
|
|
def handle(self, **options):
|
2017-05-30 15:55:38 +08:00
|
|
|
project_name = options.pop('name')
|
|
|
|
target = options.pop('directory')
|
2007-08-16 14:06:55 +08:00
|
|
|
|
2014-05-22 18:19:54 +08:00
|
|
|
# Create a random SECRET_KEY to put it in the main settings.
|
2015-04-18 16:09:41 +08:00
|
|
|
options['secret_key'] = get_random_secret_key()
|
2007-08-16 14:06:55 +08:00
|
|
|
|
2017-01-21 21:13:44 +08:00
|
|
|
super().handle('project', project_name, target, **options)
|