Code

Opened 6 years ago

Closed 3 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

Description

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 autoreload.py 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 6 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by groves

comment:1 Changed 6 years ago by anonymous

  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 6 years ago by programmerq

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

comment:3 Changed 6 years ago by adrian

  • Component changed from Tools to django-admin.py runserver

comment:4 Changed 3 years ago by gabrielhurley

  • Component changed from django-admin.py runserver to Core (Management commands)

comment:5 Changed 3 years ago by julien

  • Type set to New feature

comment:6 Changed 3 years ago by julien

  • Severity set to Normal

comment:7 Changed 3 years ago by Alex

  • Easy pickings unset
  • Resolution set to wontfix
  • Status changed from new to closed
  • 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.