#32744: Template changes cause dev server to reload
---------------------------------+------------------------------------
     Reporter:  Ryan P Kilby     |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  3.2
     Severity:  Release blocker  |               Resolution:
     Keywords:  autoreload       |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * keywords:   => autoreload
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for extra details, I'm was able to reproduce this issue with
  - `'DIRS': ['template_dir']`,
  - `'DIRS': [Path('template_dir')]`, and
  - `'DIRS': ['/full/path/to/template_dir']`.

 I think we should normalize directories to resolved `Path`s, e.g.

 {{{
 diff --git a/django/template/autoreload.py b/django/template/autoreload.py
 index 36952ef9aa..6a648ce0c3 100644
 --- a/django/template/autoreload.py
 +++ b/django/template/autoreload.py
 @@ -4,6 +4,7 @@ from django.template.backends.django import
 DjangoTemplates
  from django.utils.autoreload import (
      autoreload_started, file_changed, is_django_path,
  )
 +from django.utils._os import to_path


  def get_template_directories():
 @@ -15,13 +16,13 @@ def get_template_directories():
          if not isinstance(backend, DjangoTemplates):
              continue

 -        items.update(backend.engine.dirs)
 +        items.update(to_path(dir).resolve() for dir in
 backend.engine.dirs)

          for loader in backend.engine.template_loaders:
              if not hasattr(loader, 'get_dirs'):
                  continue
              items.update(
 -                directory
 +                to_path(directory).resolve()
                  for directory in loader.get_dirs()
                  if not is_django_path(directory)
              )
 }}}

 Regression in 658bcc16f1b814b3a063d3fa16fabaea8b471863.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32744#comment:6>
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/065.fc33972510d2f38fb9451f5cc984ae01%40djangoproject.com.

Reply via email to