Fixed #5824 -- For the `startapp` command, pass the true project name to the `copy_helper` function instead of the name of the project's parent directory.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6621 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2dfad61fcc
commit
62c574e765
|
@ -14,14 +14,13 @@ class Command(LabelCommand):
|
||||||
def handle_label(self, app_name, directory=None, **options):
|
def handle_label(self, app_name, directory=None, **options):
|
||||||
if directory is None:
|
if directory is None:
|
||||||
directory = os.getcwd()
|
directory = os.getcwd()
|
||||||
# Determine the project_name a bit naively -- by looking at the name of
|
# Determine the project_name by using the basename of directory,
|
||||||
# the parent directory.
|
# which should be the full path of the project directory (or the
|
||||||
project_dir = os.path.normpath(os.path.join(directory, os.pardir))
|
# current directory if no directory was passed).
|
||||||
parent_dir = os.path.basename(project_dir)
|
|
||||||
project_name = os.path.basename(directory)
|
project_name = os.path.basename(directory)
|
||||||
if app_name == project_name:
|
if app_name == project_name:
|
||||||
raise CommandError("You cannot create an app with the same name (%r) as your project." % app_name)
|
raise CommandError("You cannot create an app with the same name (%r) as your project." % app_name)
|
||||||
copy_helper(self.style, 'app', app_name, directory, parent_dir)
|
copy_helper(self.style, 'app', app_name, directory, project_name)
|
||||||
|
|
||||||
class ProjectCommand(Command):
|
class ProjectCommand(Command):
|
||||||
help = "Creates a Django app directory structure for the given app name in this project's directory."
|
help = "Creates a Django app directory structure for the given app name in this project's directory."
|
||||||
|
|
Loading…
Reference in New Issue