Opened 8 years ago

Closed 5 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 8 years ago.
patch to add a warning
startproject_disabled_warning.patch (3.2 KB) - added by msabramo 6 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 8 years ago by IanHolsman

Attachment: startproj.diff added

patch to add a warning

comment:1 Changed 8 years ago by Russell Keith-Magee

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 8 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Eric Holscher

Owner: changed from nobody to Eric Holscher
Status: newassigned

comment:4 Changed 8 years ago by Jacob

milestone: 1.0post-1.0

comment:5 Changed 8 years ago by Eric Holscher

Owner: Eric Holscher deleted
Status: assignednew

comment:6 Changed 8 years ago by Adrian Holovaty

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 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

Changed 6 years ago by msabramo

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

comment:8 Changed 6 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 6 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:10 Changed 5 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 5 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

Fixed in r16964.

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