Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22991 closed Bug (fixed)

Development server not reloading with *.pyc files and without inotify

Reported by: lorinkoz@… Owned by: nobody
Component: Core (Management commands) Version: 1.7-rc-1
Severity: Release blocker Keywords:
Cc: anubhav9042@…, cmawebsite@…, Stephen Burrows Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm on Windows, not sure when this started to happen but the development server is not restarting/reloading anymore when I change code in models.py. I'm not using pynotify.

Change History (14)

comment:1 by Tim Graham, 10 years ago

Cc: anubhav9042@… added
Summary: Development server reloadingDevelopment server not reloading on Windows
Type: UncategorizedBug

Anubhav, can you reproduce this? If so, could you bisect the regression?

comment:2 by Tim Graham, 10 years ago

#23020 reports the same issue on Mac OS X, but I have no problems on Linux.

comment:3 by Collin Anderson, 10 years ago

I can confirm it doesn't work and bisected it to 1bb8ccdb9e70bee35759f2ada4d661481852ab95 (Fixed pyinotify performance regression)

comment:4 by Tim Graham, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:5 by Collin Anderson, 10 years ago

Summary: Development server not reloading on WindowsDevelopment server not reloading with *.pyc files and without inotify

Ok, I can reproduce it on Ubuntu 12.04 by uninstalling python-inotify (pyinotify) and turning off sys.dont_write_bytecode (PYTHONDONTWRITEBYTECODE). It's happening on all platforms, so I'll mark #23020 as a duplicate.

comment:6 by Collin Anderson, 10 years ago

Needs tests: set

*.pyc filenames are ending up in _cached_filenames, and then being returned from the cache without being converted from .pyc to .py. This change caches the *.py filenames instead.
https://github.com/django/django/pull/2913

I also noticed an inconsistency with _error_files. It's not clear if or when those should be added to _cached_filenames and if and when inotify needs to start watching them.

I would appreciate someone else writing a test case.

comment:7 by Collin Anderson, 10 years ago

Has patch: set

comment:8 by Collin Anderson, 10 years ago

Cc: cmawebsite@… added

comment:9 by Collin Anderson, 10 years ago

_error_files handles cases from #9589 and #8413. I bet those have also regressed.

comment:10 by Stephen Burrows, 10 years ago

Cc: Stephen Burrows added

comment:11 by Collin Anderson, 10 years ago

I actually can't reproduce any _error_files issues. It seems that nowadays, either the check framework fully stops the process on models.py and admin.py errors before the autoreloader starts (would be nice to fix someday), or in other files, like views.py, it can handle re-importing the bad files without needing to reload.

Version 0, edited 10 years ago by Collin Anderson (next)

comment:12 by Claude Paroz, 10 years ago

Needs tests: unset

I've slightly adapted the PR from Collin and added a one-line test in https://github.com/django/django/pull/2918

comment:13 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 4e424084e6d796f7ed5f215330cd0b98287c1300:

Fixed #22991 -- Prevented *.pyc files in autoreload monitoring

This fixes a regression introduced in 6d302f639.
Thanks lorinkoz at gmail.com for the report, Collin Anderson
for the initial patch and Simon Charette for the review.

comment:14 by Claude Paroz <claude@…>, 10 years ago

In f2011e21a2d803ab6328852c3af4a4bf6701b11d:

[1.7.x] Fixed #22991 -- Prevented *.pyc files in autoreload monitoring

This fixes a regression introduced in 6d302f639.
Thanks lorinkoz at gmail.com for the report, Collin Anderson
for the initial patch and Simon Charette for the review.
Backport of 4e424084e from master.

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