1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Cleanup to use get_random_string consistently.

Removes several ad hoc implementations of get_random_string()
and removes an innapropriate use of settings.SECRET_KEY.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@17580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Paul McMillan
2012-02-23 21:39:12 +00:00
parent f2de5f4cab
commit 239e41f7c5
3 changed files with 18 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
from random import choice
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.crypto import get_random_string
from django.utils.importlib import import_module
@@ -27,6 +26,6 @@ class Command(TemplateCommand):
# Create a random SECRET_KEY hash to put it in the main settings.
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
options['secret_key'] = ''.join([choice(chars) for i in range(50)])
options['secret_key'] = get_random_string(50, chars)
super(Command, self).handle('project', project_name, target, **options)