Opened 16 years ago

Closed 13 years ago

#8329 closed New feature (fixed)

django shouldn't delete the startproject command

Reported by: IanHolsman Owned by:
Component: Core (Management commands) Version: dev
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 16 years ago.
patch to add a warning
startproject_disabled_warning.patch (3.2 KB ) - added by msabramo 14 years ago.
Patch to display warning when "startproject" subcommand is disabled because of DJANGO_SETTINGS_MODULE

Download all attachments as: .zip

Change History (13)

by IanHolsman, 16 years ago

Attachment: startproj.diff added

patch to add a warning

comment:1 by Russell Keith-Magee, 16 years ago

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

Triage Stage: UnreviewedAccepted

comment:3 by Eric Holscher, 16 years ago

Owner: changed from nobody to Eric Holscher
Status: newassigned

comment:4 by Jacob, 16 years ago

milestone: 1.0post-1.0

comment:5 by Eric Holscher, 16 years ago

Owner: Eric Holscher removed
Status: assignednew

comment:6 by Adrian Holovaty, 16 years ago

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

milestone: post-1.0

Milestone post-1.0 deleted

by msabramo, 14 years ago

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

comment:8 by msabramo, 14 years ago

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 by Luke Plant, 13 years ago

Severity: Normal
Type: New feature

comment:10 by msabramo, 13 years ago

Easy pickings: unset
UI/UX: unset

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

comment:11 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in r16964.

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