#33473: Dev Server fails to restart after adding BASE_DIR to 
TEMPLATES[0]['DIRS']
in settings
-------------------------------+--------------------------------------
     Reporter:  craiglabenz    |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  Uncategorized  |                  Version:  4.0
     Severity:  Normal         |               Resolution:
     Keywords:  development    |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Hrushikesh Vaidya):

 * cc: Hrushikesh Vaidya (added)


Comment:

 Replying to [comment:2 Keryn Knight]:

 > > Django does not watch for changes in template directories by design.
 > It does, via the `template_changed` signal listener

 My bad, I meant that Django does not watch for changes in template
 directories to ''reload the server''. The `template_changed` signal
 listener returns `True` if the change occurs in a file located in a
 designated template directory, which causes `notify_file_changed` to not
 trigger the reload.

 AFAIK from browsing the code, for a python file (or actually any file not
 in a template directory), the `template_changed` signal listener returns
 `None`, which causes `notify_file_changed` to trigger the reload, right?

 So could we fix this by checking if the changed file is a python file
 inside the `template_changed` signal listener, regardless of whether it is
 in a template directory?

 {{{
 def template_changed(sender, file_path, **kwargs):
     if file_path.suffix == '.py':
         return
     # Now check if the file was a template file
 }}}

 This seems to work on a test project, but I have not checked for side
 effects, although I don't think there should be any.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33473#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/069.c3aed6ffbc307913df284565dfeae8d2%40djangoproject.com.

Reply via email to