Opened 11 years ago

Closed 8 years ago

#6863 closed New feature (wontfix)

Allow multiple sources for files to check in autoreload

Reported by: groves Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I've got a set of data files that I read when my Django app starts, after which I cache them for the rest of the run. I'd like for a change to one of those files to cause the autoreloader to do its thing. To accomplish this, I added a list of source functions to autoreload that are called in turn whenever the autoreloader runs. The functions are expected to return a sequence of files for mtime checking. The initial sources list just contains a function that does the current listing of all files in sys.modules.

This could probably use some documentation, but I don't think anything in itself makes sense. It seems like it'd be more appropriate somewhere user visible on the site, but I'm not sure where that would be exactly. If someone would point me to the right file, I'll happily add some documentation to the patch.

Attachments (1)

autoreload_sources.diff (1.1 KB) - added by groves 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by groves

Attachment: autoreload_sources.diff added

comment:1 Changed 11 years ago by anonymous

Needs documentation: set
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 11 years ago by Jeff Anderson

sorry, it was me who changed the triage stage. I forgot to log in.

comment:3 Changed 11 years ago by Adrian Holovaty

Component: runserver

comment:4 Changed 8 years ago by Gabriel Hurley

Component: runserverCore (Management commands)

comment:5 Changed 8 years ago by Julien Phalip

Type: New feature

comment:6 Changed 8 years ago by Julien Phalip

Severity: Normal

comment:7 Changed 8 years ago by Alex Gaynor

Easy pickings: unset
Resolution: wontfix
Status: newclosed
UI/UX: unset

Discussion with Carl: this is a pretty uncommon problem, and this (and likely any other solution in Django) will be pretty ugly, adding more global state. Carl notes that you can fix this by putting a fake module in sys.modules, which while heinously ugly, puts it in you *your* project, and not Django.

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