Skip to content

Commit

Permalink
Prevent people from using "startapp" to create apps with the same nam…
Browse files Browse the repository at this point in the history
…e 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
  • Loading branch information
malcolmt committed May 19, 2006
1 parent d5c9e19 commit 816b65f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions django/core/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down

0 comments on commit 816b65f

Please sign in to comment.