Jinja2 auto_reload left at its True default in production, where Flask had it False

Open Beginner friendly
#5,877 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start in web/template_config.py and inspect how the existing debug flag is made available to template configuration. Set Jinja2 auto_reload from that flag, then verify that production disables reload while debug mode preserves it; the change is done when the configuration no longer performs the unnecessary production stat checks.

Written by the indexing model from the issue text.

Description

Jinja2's auto_reload defaults to True, and web/template_config.py does not override it. Flask's production default was False (it tracked app.debug, which was never set true pre-port), so this is a port-introduced behaviour change.

Effect: an extra stat() per template per render, forever, in production.

Caveat — this is a performance nit, not a bug, and a small one. For a self-hosted single-user-ish app the cost is genuinely marginal, and I would not raise it on its own. It is filed because it is invisible: nothing surfaces it, it will never fail a test, and it is the kind of default that quietly stays wrong for years once the port is forgotten.

It becomes worth caring about in exactly one scenario: a deployment on slow or network-backed storage, where repeated stat() on 46 templates per render is no longer free.

Fix is one keyword argument, gated on the same debug flag Flask used.

Dominant language
Python
Stars
9.1k
Forks
824
Avg merge
3d 4h
Merged PRs (30d)
289

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LearningCircuit/local-deep-research

All issues in LearningCircuit/local-deep-research

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.