#27254: Detect management command context
-------------------------------+--------------------
     Reporter:  beruic         |      Owner:  nobody
         Type:  New feature    |     Status:  new
    Component:  Uncategorized  |    Version:  1.10
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 I have some code in my project that generates some content for my pages
 (compiles documentation).

 I would like this code to run once every time the server starts, and
 essentially I should use `AppConfig.ready()` to do this. However
 `AppConfig.ready()` also runs when I run any management command, which is
 very undesirrable, as I don't want to generate this content every time I
 run unrelated tasks, such as `migrate`.

 Therefore it would be nice to have a flag or some other means to detect if
 code is currently running in the context a web server or not.

 For now I have implemented this as a middleware which throws
 `MiddlewareNotUsed` after generating the content.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.07c8bc3ecc377a5ef26191a34c252033%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to