Opened 7 years ago

Closed 4 years ago

#8329 closed New feature (fixed)

django shouldn't delete the startproject command

Reported by: IanHolsman Owned by:
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

but put a warning in it's place

Attachments (2)

startproj.diff (2.0 KB) - added by IanHolsman 7 years ago.
patch to add a warning
startproject_disabled_warning.patch (3.2 KB) - added by msabramo 5 years ago.
Patch to display warning when "startproject" subcommand is disabled because of DJANGO_SETTINGS_MODULE

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by IanHolsman

patch to add a warning

comment:1 Changed 7 years ago by russellm

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement set

No problem with the idea here, but there is a problem with the implementation. Using this approach, startproject will appear on the list of valid commands when you run django-admin.py help.

Also, as a matter of style, I would also be temped to refactor InvalidStartProjectContextCommand into a more generic DisabledCommand that can be configured with a generic message explaining why a command has been disabled. We only have one disabled command right now, but I can see that it could be useful in other circumstances.

Tests integrated with admin_scripts would also be desirable.

comment:2 Changed 7 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by ericholscher

  • Owner changed from nobody to ericholscher
  • Status changed from new to assigned

comment:4 Changed 7 years ago by jacob

  • milestone changed from 1.0 to post-1.0

comment:5 Changed 7 years ago by ericholscher

  • Owner ericholscher deleted
  • Status changed from assigned to new

comment:6 Changed 7 years ago by adrian

Another (granted, small) problem with this patch: the error message is a bit awkward. I'd rephrase it like this --

The "startproject" command is disabled, because you've already defined a project. To create a new project, unset your DJANGO_SETTINGS_MODULE environment variable.

comment:7 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Changed 5 years ago by msabramo

Patch to display warning when "startproject" subcommand is disabled because of DJANGO_SETTINGS_MODULE

comment:8 Changed 5 years ago by msabramo

My patch takes a bit of a different approach from Ian's. With it, "startproject" is not displayed as an available subcommand (like the current behavior), but a warning is printed.

Ian's patch is interesting. I hadn't seen it before I created my own. I can't decide whether I like his (ideally with the changes suggested by Adrian and Russell) or mine better.

I know I don't like silently removing the command.

comment:9 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:10 Changed 4 years ago by msabramo

  • Easy pickings unset
  • UI/UX unset

Any comments on my patch (or Ian's)? If it needs some tweaks, let me know.

comment:11 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r16964.

Note: See TracTickets for help on using tickets.
Back to Top