forked from 0x2620/pandora
use pyinotify to watch for config changes if installed
This commit is contained in:
parent
31652fe3d8
commit
c576e347a8
2 changed files with 26 additions and 13 deletions
|
@ -96,6 +96,18 @@ check the README for further details.
|
|||
|
||||
def reloader_thread():
|
||||
_config_mtime = 0
|
||||
try:
|
||||
import pyinotify
|
||||
INOTIFY = True
|
||||
except:
|
||||
INOTIFY = False
|
||||
if INOTIFY:
|
||||
wm = pyinotify.WatchManager()
|
||||
name = os.path.realpath(settings.SITE_CONFIG)
|
||||
wm.add_watch(name, pyinotify.IN_CLOSE_WRITE, lambda event: load_config())
|
||||
notifier = pyinotify.Notifier(wm)
|
||||
notifier.loop()
|
||||
else:
|
||||
while RUN_RELOADER:
|
||||
try:
|
||||
stat = os.stat(settings.SITE_CONFIG)
|
||||
|
@ -105,10 +117,10 @@ def reloader_thread():
|
|||
if mtime > _config_mtime:
|
||||
load_config()
|
||||
_config_mtime = mtime
|
||||
time.sleep(1)
|
||||
except:
|
||||
#sys.stderr.write("reloading config failed\n")
|
||||
pass
|
||||
time.sleep(1)
|
||||
|
||||
def update_static():
|
||||
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
|
||||
|
|
|
@ -34,6 +34,7 @@ sudo vmbuilder vbox ubuntu --suite=precise \
|
|||
--addpkg python-imaging \
|
||||
--addpkg python-numpy \
|
||||
--addpkg python-psycopg2 \
|
||||
--addpkg python-pyinotify \
|
||||
--addpkg python-simplejson \
|
||||
--addpkg python-lxml \
|
||||
--addpkg python-html5lib \
|
||||
|
|
Loading…
Reference in a new issue