mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Fixed #4688 -- startproject no longer breaks when Django files are read-only. Thanks, tstromberg@google.com and Google guys
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5593 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		
							
								
								
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							| @@ -235,6 +235,7 @@ answer newbie questions, and generally made Django that much better: | |||||||
|     Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> |     Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> | ||||||
|     torne-django@wolfpuppy.org.uk |     torne-django@wolfpuppy.org.uk | ||||||
|     Karen Tracey <graybark@bellsouth.net> |     Karen Tracey <graybark@bellsouth.net> | ||||||
|  |     tstromberg@google.com | ||||||
|     Makoto Tsuyuki <mtsuyuki@gmail.com> |     Makoto Tsuyuki <mtsuyuki@gmail.com> | ||||||
|     tt@gurgle.no |     tt@gurgle.no | ||||||
|     Amit Upadhyay |     Amit Upadhyay | ||||||
|   | |||||||
| @@ -832,9 +832,15 @@ def startproject(project_name, directory): | |||||||
|         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)) |         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)) | ||||||
|         sys.exit(1) |         sys.exit(1) | ||||||
|     _start_helper('project', project_name, directory) |     _start_helper('project', project_name, directory) | ||||||
|  |  | ||||||
|     # Create a random SECRET_KEY hash, and put it in the main settings. |     # Create a random SECRET_KEY hash, and put it in the main settings. | ||||||
|     main_settings_file = os.path.join(directory, project_name, 'settings.py') |     main_settings_file = os.path.join(directory, project_name, 'settings.py') | ||||||
|     settings_contents = open(main_settings_file, 'r').read() |     settings_contents = open(main_settings_file, 'r').read() | ||||||
|  |  | ||||||
|  |     # If settings.py was copied from a read-only source, make it writeable. | ||||||
|  |     if not os.access(main_settings_file, os.W_OK): | ||||||
|  |         os.chmod(main_settings_file, 0600) | ||||||
|  |  | ||||||
|     fp = open(main_settings_file, 'w') |     fp = open(main_settings_file, 'w') | ||||||
|     secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) |     secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) | ||||||
|     settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents) |     settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user