Ticket #6509: 6509.diff

File 6509.diff, 862 bytes (added by Thomas Güttler, 16 years ago)

Patch for startapp only, based on check in startproject.

  • django/core/management/commands/startapp.py

     
    2323        if app_name == project_name:
    2424            raise CommandError("You cannot create an app with the same name"
    2525                               " (%r) as your project." % app_name)
     26        try:
     27            module = __import__(app_name)
     28            if module:
     29                raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a application name. Please try another name." % app_name)
     30        except ImportError:
     31            pass
     32
    2633        copy_helper(self.style, 'app', app_name, directory, project_name)
    2734
    2835class ProjectCommand(Command):
Back to Top