From 816b65f260e98b1b65ab171a807d0c9bad7328f1 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 19 May 2006 07:40:06 +0000 Subject: [PATCH] Prevent people from using "startapp" to create apps with the same name as their project. Might stop some of the accidents. git-svn-id: http://code.djangoproject.com/svn/django/trunk@2946 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/django/core/management.py b/django/core/management.py index 38d46e864d..a3a28af1af 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -665,6 +665,9 @@ def startapp(app_name, directory): # the parent directory. project_dir = os.path.normpath(os.path.join(directory, '..')) project_name = os.path.basename(project_dir) + if app_name == os.path.basename(directory): + sys.stderr.write(style.ERROR("Error: You cannot create an app with the same name (%r) as your project.\n" % app_name)) + sys.exit(1) _start_helper('app', app_name, directory, project_name) startapp.help_doc = "Creates a Django app directory structure for the given app name in the current directory." startapp.args = "[appname]"