[Django] #19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't end with a slash

8 views
Skip to first unread message

Django

unread,
Feb 1, 2013, 11:32:22 PM2/1/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
--------------------------------------------+------------------------
Reporter: peter.davis8@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management commands) | Version: 1.5-beta-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+------------------------
When the MEDIA_URL setting in settings.py does not contain a forward slash
at the end, calling manage.py without arguments will result in only django
core commands being displayed, but no application commands (as specified
in INSTALLED_APPS) are shown.

This is presumably due to the parsing of the settings.py file failing
silently on the incorrect MEDIA_URL setting. Although it is explicitly
called out within the settings.py file (within comments above the
MEDIA_URL setting), having it fail loudly when running manage.py is
potentially a more expected behaviour.

--
Ticket URL: <https://code.djangoproject.com/ticket/19724>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 2, 2013, 4:21:52 AM2/2/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------

Reporter: peter.davis8@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

I can reproduce the problem and I think it's caused by:
{{{
try:
apps = settings.INSTALLED_APPS
except ImproperlyConfigured:
# Still useful for commands that do not require functional
settings,
# like startproject or help
apps = []
}}}
in `django.core.management.get_commands`, as an invalid `MEDIA_URL` raises
`ImproperlyConfigured` when the settings are first accessed.

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:1>

Django

unread,
Feb 2, 2013, 4:22:06 AM2/2/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody
Type: Bug | Status: new

Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:2>

Django

unread,
Feb 2, 2013, 5:40:14 AM2/2/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:3>

Django

unread,
Feb 2, 2013, 11:02:46 PM2/2/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin

Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by julien):

* stage: Accepted => Ready for checkin


Comment:

That looks great to me! Just one nitpicky comment: it'd be useful to
emphasize the causality between the two statements:

{{{
Project settings contain errors: <ERROR>
As a result, only the core Django commands are available.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:4>

Django

unread,
Feb 4, 2013, 5:54:49 AM2/4/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"40ca99097f34b2180b2afe6d0056cade4c732618"]:
{{{
#!CommitTicketReference repository=""
revision="40ca99097f34b2180b2afe6d0056cade4c732618"
Fixed #19724 -- Output error when settings are improperly configured

...during retrieval of available management commands.
Thanks Peter Davis for the report and Julien Phalip for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:5>

Django

unread,
Feb 4, 2013, 6:16:56 AM2/4/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody

Type: Bug | Status: closed
Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"2edef932ff4ffc766c7abe18bde2cc77babd8fef"]:
{{{
#!CommitTicketReference repository=""
revision="2edef932ff4ffc766c7abe18bde2cc77babd8fef"
Revert "Fixed #19724 -- Output error when settings are improperly
configured"

This reverts commit 40ca99097f34b2180b2afe6d0056cade4c732618.
Outputting error is not always suitable, for example this shouldn't
happen for the 'startproject' command.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:6>

Django

unread,
Feb 4, 2013, 6:19:43 AM2/4/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody
Type: Bug | Status: new

Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: closed => new
* resolution: fixed =>


Comment:

The patch was not good.
For example, when running `django-admin.py startproject`, accessing
`settings.INSTALLED_APPS` will always raise `ImproperlyConfigured` and
this is the regular behaviour (no errors should be shown).

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:7>

Django

unread,
Feb 4, 2013, 6:20:22 AM2/4/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:8>

Django

unread,
Oct 21, 2013, 3:28:24 PM10/21/13
to django-...@googlegroups.com
#19724: manage.py app commands enumeration fails silently when MEDIA_URL doesn't
end with a slash
-------------------------------------+-------------------------------------
Reporter: peter.davis8@… | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version:
commands) | 1.5-beta-1
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a098bee1b9fa4df64f3fd72ff5cbae43bf27e539"]:
{{{
#!CommitTicketReference repository=""
revision="a098bee1b9fa4df64f3fd72ff5cbae43bf27e539"
Fixed #19724 -- Output note when showing only core management commands

When listing available management commands, only core commands are
listed if settings have any error. This commit adds a note in this
case so errors are not totally silently skipped.
Thanks Peter Davis for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19724#comment:9>

Reply all
Reply to author
Forward
0 new messages