ExecuteTask '0.1.0.2') File “/.../google/appengine/tools/devappserver2/dispatcher.py”, line 587, in add_request headers_dict['Host'], urlparse.urlsplit(relative_url).path) File “/.../google/appengine/tools/devappserver2/dispatcher.py”, line 653, in _resolve_target raise request_info.ModuleDoesNotExistError(hostname) ModuleDoesNotExistError: webapp.khanacademy.local
17:38:45 2013 -0700 ! Reintroduce fsevents_file_watcher.py This patch makes fsevents_file_watcher the default again on Mac. It was removed in the 1.8.x SDK versions. To use the mtime_file_watcher instead, invoke "dev_appserver.py --use_mtime_file_watcher=yes" You will need pyobjc installed to use the fsevents file watcher. Running "pip install pyobjc" should do the trick. The old file watcher was resurrected from version control at https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine It's easiest to apply this patch using `git am <this.patch` or `patch -p1 <this.patch` after having already applied watcher-skip-files.patch
Do the file watching in a thread to ensure that # FSEventStreamScheduleWithRunLoop and CFRunLoopRunInMode are called in the # same thread. ! # Each thread needs its own AutoreleasePool. pool = AppKit.NSAutoreleasePool.alloc().init() event_stream = FSEvents.FSEventStreamCreate( None, self._fsevents_callback, None, [self._directory], FSEvents.kFSEventStreamEventIdSinceNow, 1, # Seconds to wait to between received events. FSEvents.kFSEventStreamCreateFlagNone, ) ! FSEvents.FSEventStreamScheduleWithRunLoop(event_stream, FSEvents.CFRunLoopGetCurrent(), FSEvents.kCFRunLoopDefaultMode)
Do the file watching in a thread to ensure that # FSEventStreamScheduleWithRunLoop and CFRunLoopRunInMode are called in the # same thread. ! # Each thread needs its own AutoreleasePool. pool = AppKit.NSAutoreleasePool.alloc().init() event_stream = FSEvents.FSEventStreamCreate( None, self._fsevents_callback, None, [self._directory], FSEvents.kFSEventStreamEventIdSinceNow, 1, # Seconds to wait to between received events. # We're interested in per-file (not per-directory) events. FSEvents.kFSEventStreamCreateFlagFileEvents, ) ! FSEvents.FSEventStreamScheduleWithRunLoop(event_stream, FSEvents.CFRunLoopGetCurrent(), FSEvents.kCFRunLoopDefaultMode)
There are other flags, but these ones specifically indicate that a single # file has changed in some way. change_flags = ( FSEvents.kFSEventStreamEventFlagItemCreated | FSEvents.kFSEventStreamEventFlagItemRemoved | FSEvents.kFSEventStreamEventFlagItemInodeMetaMod | FSEvents.kFSEventStreamEventFlagItemRenamed | FSEvents.kFSEventStreamEventFlagItemModified | FSEvents.kFSEventStreamEventFlagItemFinderInfoMod | FSEvents.kFSEventStreamEventFlagItemChangeOwner | FSEvents.kFSEventStreamEventFlagItemXattrMod) ! for path, flag in zip(event_paths, event_flags): ! # Ignore the event if it doesn't match any of the aforementioned flags. if not flag & change_flags: continue ! # Ignore the path if it is an ignored directory. if any(d in path for d in watcher_common._IGNORED_DIRS): continue ! # Ignore the path if it has an ignored file extension. if watcher_common.ignore_file(os.path.split(path)[1]): continue ! # We found a changed file that we want to trigger a reload. self._has_changes = True return