Ticket #8329: startproj.diff

File startproj.diff, 2.0 KB (added by IanHolsman, 7 years ago)

patch to add a warning

  • django/core/management/base.py

     
    169169    def handle_label(self, label, **options):
    170170        raise NotImplementedError()
    171171
     172class InvalidStartProjectContextCommand(BaseCommand):
     173    args = ''
     174
     175    def handle(self, *args, **options):
     176        #if args:
     177        raise CommandError("The startproject command has been disabled as you have a project defined. Hint unset your DJANGO_SETTINGS_MODULE environment variable")
     178        #return self.handle_noargs(**options)
     179
     180    def handle_noargs(self, **options):
     181        raise CommandError("The startproject command has been disabled as you have a project defined. Hint unset your DJANGO_SETTINGS_MODULE environment variable")
     182        #raise NotImplementedError()
     183
     184
    172185class NoArgsCommand(BaseCommand):
    173186    args = ''
    174187
  • django/core/management/__init__.py

     
    44from imp import find_module
    55
    66import django
    7 from django.core.management.base import BaseCommand, CommandError, handle_default_options
     7from django.core.management.base import BaseCommand, CommandError, handle_default_options, InvalidStartProjectContextCommand
    88
    99# For backwards compatibility: get_version() used to be in this module.
    1010get_version = django.get_version
     
    125125        if project_directory:
    126126            # Remove the "startproject" command from self.commands, because
    127127            # that's a django-admin.py command, not a manage.py command.
    128             del _commands['startproject']
     128            #del _commands['startproject']
     129            _commands['startproject'] = InvalidStartProjectContextCommand()
    129130
    130131            # Override the startapp command so that it always uses the
    131132            # project_directory, not the current working directory
Back to Top