Ticket #1755: django_1755.patch
File django_1755.patch, 2.8 KB (added by , 19 years ago) |
---|
-
conf/project_template/settings.py
26 26 LANGUAGE_CODE = 'en-us' 27 27 28 28 SITE_ID = 1 29 SITE_DOMAIN_NAME = 'example.com' 30 SITE_DISPLAY_NAME = 'example.com' 29 31 32 SUPERUSER_USERNAME = 'root' 33 SUPERUSER_EMAIL = 'root@example.com' 34 SUPERUSER_PASSWORD = 'password' 35 30 36 # Absolute path to the directory that holds media. 31 37 # Example: "/home/media/media.lawrence.com/" 32 38 MEDIA_ROOT = '' -
contrib/auth/management.py
5 5 from django.dispatch import dispatcher 6 6 from django.db.models import get_models, signals 7 7 from django.contrib.auth import models as auth_app 8 from django.conf import settings 8 9 9 10 def _get_permission_codename(action, opts): 10 11 return '%s_%s' % (action, opts.object_name.lower()) … … 38 39 from django.contrib.auth.models import User 39 40 from django.contrib.auth.create_superuser import createsuperuser as do_create 40 41 if User in created_models: 41 msg = "\nYou just installed Django's auth system, which means you don't have " \ 42 "any superusers defined.\nWould you like to create one now? (yes/no): " 43 confirm = raw_input(msg) 44 while 1: 45 if confirm not in ('yes', 'no'): 46 confirm = raw_input('Please enter either "yes" or "no": ') 47 continue 48 if confirm == 'yes': 49 do_create() 50 break 42 if settings.SUPERUSER_USERNAME and settings.SUPERUSER_EMAIL and settings.SUPERUSER_PASSWORD: 43 do_create(settings.SUPERUSER_USERNAME, settings.SUPERUSER_EMAIL, settings.SUPERUSER_PASSWORD) 51 44 52 45 dispatcher.connect(create_permissions, signal=signals.post_syncdb) 53 46 dispatcher.connect(create_superuser, sender=auth_app, signal=signals.post_syncdb) -
contrib/sites/management.py
6 6 from django.db.models import signals 7 7 from django.contrib.sites.models import Site 8 8 from django.contrib.sites import models as site_app 9 from django.conf import settings 9 10 10 11 def create_default_site(app, created_models): 11 12 if Site in created_models: 12 print "Creating example.comSite object"13 s = Site(domain= "example.com", name="example.com")13 print "Creating default Site object" 14 s = Site(domain=settings.SITE_DOMAIN_NAME, name=settings.SITE_DISPLAY_NAME) 14 15 s.save() 15 16 16 17 dispatcher.connect(create_default_site, sender=site_app, signal=signals.post_syncdb)