« Day 3: Using plackup | Main | Day 5: Run a static web server with Plack »

12/04/2009

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Brad Choate

Django's autoreloader used with the native 'runserver' command uses a secondary thread that scans loaded modules (sys.modules), sleeps for a second, then repeats. You could do something similar by monitoring mtimes for files found in %INC. That just hits code of course -- it wouldn't cause the app to reload when static files are modified (like a configuration 'yaml' file or something). But Django's configuration is also a Python module, so that's covered.

miyagawa

Brad: Yes, the way we scan file mtimes is almost the same -- except that we don't use thread but use forked child process instead. Using %INC would be neat and could be a sensible default.

Though I don't think you'll ever need to edit modules that are loaded from the system path. Instead you can simply specify your application path with -R and done with it.

Sartak

I was worried you had reinvented File::ChangeNotify but it looks like you're using it. Cool. :)

miyagawa

Sartak: Yes i intentionally reinvented File::ChangeNotify - as another CPAN module Filesys::Notify::Simple. The whole purpose was to eliminate the non-core XS dependency and make it easier to install.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name is required. Email address will not be displayed with the comment.)

June 2013

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
Blog powered by Typepad