Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4688 -- startproject no longer breaks when Django files are re…

…ad-only. Thanks, tstromberg@google.com and Google guys

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5593 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ee7fe94d45150fad2c90a16ae23034a8bba98efd 1 parent f9a592d
Adrian Holovaty authored July 03, 2007
1  AUTHORS
@@ -235,6 +235,7 @@ answer newbie questions, and generally made Django that much better:
235 235
     Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
236 236
     torne-django@wolfpuppy.org.uk
237 237
     Karen Tracey <graybark@bellsouth.net>
  238
+    tstromberg@google.com
238 239
     Makoto Tsuyuki <mtsuyuki@gmail.com>
239 240
     tt@gurgle.no
240 241
     Amit Upadhyay
6  django/core/management.py
@@ -832,9 +832,15 @@ def startproject(project_name, directory):
832 832
         sys.stderr.write(style.ERROR("Error: '%r' conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.\n" % project_name))
833 833
         sys.exit(1)
834 834
     _start_helper('project', project_name, directory)
  835
+
835 836
     # Create a random SECRET_KEY hash, and put it in the main settings.
836 837
     main_settings_file = os.path.join(directory, project_name, 'settings.py')
837 838
     settings_contents = open(main_settings_file, 'r').read()
  839
+
  840
+    # If settings.py was copied from a read-only source, make it writeable.
  841
+    if not os.access(main_settings_file, os.W_OK):
  842
+        os.chmod(main_settings_file, 0600)
  843
+
838 844
     fp = open(main_settings_file, 'w')
839 845
     secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
840 846
     settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)

0 notes on commit ee7fe94

Please sign in to comment.
Something went wrong with that request. Please try again.