Changeset 1042 for locker/deploy/bin


Ignore:
Timestamp:
Apr 1, 2009, 11:50:09 AM (13 years ago)
Author:
mitchb
Message:
More fixes and improvements to the django autoinstaller
 o Set ADMIN_MEDIA_PREFIX so that the admin app's CSS works
 o Enable the admin app and docs
 o Initialize the database properly
 o Create a superuser account
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/deploy/bin/django

    r1038 r1042  
    5858  } elsif (/Chicago/) {
    5959    $_ =~ s/Chicago/New_York/;
     60  } elsif (/^ADMIN_MEDIA_PREFIX/) {
     61    $_ = "ADMIN_MEDIA_PREFIX = '/__scripts/django/media/'";
     62  } elsif (/^INSTALLED_APPS/) {
     63    print NEWSETTINGS "$_\n";
     64    while (<SETTINGS>) {
     65      if (/^\)/) {
     66        print NEWSETTINGS "    'django.contrib.admin',\n";
     67        print NEWSETTINGS "    'django.contrib.admindocs',\n";
     68      }
     69      print NEWSETTINGS $_;
     70    }
    6071  }
    6172  print NEWSETTINGS "$_\n";
     
    6475close SETTNGS;
    6576rename "settings.py.new", "settings.py";
     77
     78open URLS, "urls.py";
     79open NEWURLS, ">urls.py.new";
     80while (<URLS>) {
     81  chomp;
     82  if (/^#.*from django\.contrib import admin/) {
     83    $_ =~ s/^# *//;
     84  } elsif (/^#.*admin.autodiscover/) {
     85    $_ =~ s/^# *//;
     86  } elsif (/^ *# *\(r\'\^admin\//) {
     87    $_ =~ s/# *//;
     88  }
     89  print NEWURLS "$_\n";
     90}
     91close NEWURLS;
     92close URLS;
     93rename "urls.py.new", "urls.py";
     94
     95print "Initializing your project's SQL database schema...\n";
     96system qw{./manage.py syncdb --noinput};
     97print "...done\n";
     98
     99print "Creating your superuser account... ";
     100system qw{./manage.py createsuperuser --username}, $admin_username, "--email", $email, "--noinput";
     101print "done\n";
     102print "Setting your superuser password... ";
     103system qw{mysql -D}, "$USER+$addrlast", "-e", "UPDATE auth_user SET password=MD5(\'$admin_password\') WHERE username=\'$admin_username\'";
     104print "done\n";
    66105
    67106print "\nDjango has been installed.\n\nYour project is located in:\n";
Note: See TracChangeset for help on using the changeset viewer.