Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#32745 closed Bug (duplicate)

Django 3.2 is auto reloading when template files are changed

Reported by: Riccardo Di Virgilio Owned by: nobody
Component: Template system Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The new version of Django 3.2 is forcing the auto reloading of all templates files, and there is no way to switch this feature off.
For development I don't used any cached reloader and the legacy strategy of not reloading the server on template changes worked quite well for several years.
When upgrading to Django 3.2 people working with me started complaining that any tiny change in html is now forcing the project to auto reload, this might not seems a big deal on a small project, but on a project of the size I'm working on it takes several seconds to reload.

Unfortunately the current implementation is automatically opting you in here if you use Django templates:

https://github.com/django/django/blob/main/django/template/autoreload.py#L9

And there is no way to turn this off, so I needed to switch back to Django 3.1 because this slowdown while developing is a dealbreaker for us.

I'm proposing 2 ways of fixing this:

  1. A setting under TEMPLATES
  2. Instead of checking if the class has a method named get_dirs, check if there is a property called "should_autoreload", this way I can at least subclass the loader and disable it.

I can contribute if you need, I have already done some small contributions I would be happy to help here.

Thanks.

Change History (5)

comment:1 by Mariusz Felisiak, 3 years ago

Duplicate of #32744.

comment:2 by Mariusz Felisiak, 3 years ago

Resolution: duplicate
Status: newclosed

comment:3 by Carlton Gibson, 3 years ago

Hi Riccardo — can you follow-up on #32744 please? As I wrote there, this isn't currently reproducing for me. (Just tried again with a fresh project, without luck, so more details are needed.) Thanks.

comment:4 by Riccardo Di Virgilio, 3 years ago

Hi, sorry I was unable to find the duplicated ticket, where is it?

Thanks again.

comment:5 by Carlton Gibson, 3 years ago

Hi Riccardo, sorry I missed your comment: the main ticket is #32744. There's a PR that should fix it, if you'd like to test at https://github.com/django/django/pull/14407
Thanks!

Note: See TracTickets for help on using tickets.
Back to Top