Tuesday, October 27, 2015

Re: How to create a global management command?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBCAAGBQJWL/BvAAoJEC0ft5FqUuEhrd0P/2Y1vFPB/ys4yWLDJXi4S8B7
E+HaQKyS1xI7nCy2hn5+sncDGy5sdc4rLyJGCzS1Z/PB1AObuw2csgt3RsRQfZ43
1TFKCSgYKgiy2zfRUFIM80Bw3DxIFEDMKxH1r8VCYhq5rlJNe5Mw0wwuqylU9LjU
DcUgnCUxsbLM+0RUl4aYSWee0+V0NPyXccIzzDNmI/aKXC080CHsaCtIQAkA9FHT
uKLb4N7J8mlMMgvOtE18PNK8KRoViALpNlOzZJ9Ep2sXSJpkDYYwfQr/gP5bKhv4
aOQ4hp++cEVmgHQB+6KLNTKCJrAaOuDe2xXYNXPGAtwbvMRTPCIIbl/Er1WADg6O
KYIQJSU1j93T/c75Bt9NkJAdb/C0kmDvVOh2AKeS+yfx74t87d9RZjHIqppydohw
uCTS4Ex2TqBhSty+VbHbvNENi//oYowdwJxRKz4eXT/uhedT6C1HcddIu96cFDnj
VyvSLuv+phsUADXVooPe+bs1TtkUCSQM3W64W8PKhh4J/mae2Svz5lyr01soVJ+l
H6ztjb0sK+fSsC4X8HziUC1TSK5A3Ir7IoLT+QU7a4lp2dzJupw77uXeep6UWhTr
7p1zZ8rIkov+fyYdrtB/NjTWbN/1phw2A76kB1rHhRYLQfLI03sAhAyzLjcpBcDg
7vwm4yZw87364dfGjKY3
=pysg
-----END PGP SIGNATURE-----
Hi,

On 10/27/2015 03:40 PM, bwv549 wrote:
> I have some commands I'd like to include in the manage command (i.e.,
> like 'coverage'). How to make a global command? (I've written many
> commands for apps, but wonder how to make one that isn't tied to any app).

You can't. Management commands are always tied to an app.

That said, many people have an overly-narrow view of what an "app" must
be. A Django "app" can be any Python package at all that you include a
reference to in your INSTALLED_APPS setting. It doesn't need to have
models, or urls, or views. For instance, I often list my top-level
project package in INSTALLED_APPS as an "app", just so I can put e.g.
management commands or template tags there, if they are really
project-wide utilities that don't naturally fit in any sub-package/app.

Note of course that which app contains a management command has no
practical effect on its use (except when it comes to overriding
management commands and the ordering of `INSTALLED_APPS`).

Carl

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/562FF06B.5000504%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment