#32669: Allow autoreloading of `python -m custom_module runserver`
-------------------------------------+-------------------------------------
     Reporter:  Moriyoshi Koizumi    |                    Owner:  Moriyoshi
                                     |  Koizumi
         Type:  New feature          |                   Status:  assigned
    Component:  Utilities            |                  Version:  4.0
     Severity:  Normal               |               Resolution:
     Keywords:  autoreload           |             Triage Stage:  Accepted
  runserver                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by William Schwartz):

 Looks fine. The one change I'd make is that I'd change

 {{{#!python
 modspec.name.split(".")[-1] == "__main__"
 }}}

 to

 {{{#!python
 modspec.name == "__main__" or modspec.name.endswith(".__main__")
 }}}

 to avoid dumb corner cases like a module named `foo.my__main__` (which is
 how
 
[https://github.com/python/cpython/blob/fa03efda3dc6ad118788bebc61079cd481c0b24c/Lib/runpy.py#L143
 runpy.py] itself deals with it).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32669#comment:3>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.45c0349ad802f041970820204d14867c%40djangoproject.com.

Reply via email to