mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 17:21:55 +00:00
Implement watching static files
This commit is contained in:
parent
c1f867f97c
commit
642ca7f54c
19
lib/debug.py
Normal file
19
lib/debug.py
Normal file
@ -0,0 +1,19 @@
|
||||
from glob import iglob as glob
|
||||
from itertools import chain
|
||||
|
||||
from tornado.autoreload import watch
|
||||
|
||||
|
||||
# yo dawg, we heard you like generators, so now you can generate generators
|
||||
# with generators
|
||||
def _static_files():
|
||||
return chain.from_iterable(
|
||||
glob(pattern) for pattern in (
|
||||
'static/*.js', 'static/*.css', 'templates/*htm?'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def watch_static_files():
|
||||
for file in _static_files():
|
||||
watch(file)
|
@ -7,6 +7,7 @@ from tornado.web import Application
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
from config import WEB_PORT
|
||||
import debug
|
||||
from handlers import MainHandler, ZMQWebSocketHandler, LoginWebappHandler
|
||||
import ui_modules
|
||||
|
||||
@ -23,6 +24,7 @@ if __name__ == '__main__':
|
||||
ui_modules=ui_modules,
|
||||
autoreload=True
|
||||
)
|
||||
|
||||
application.listen(WEB_PORT)
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
logging.debug('Python version: {}'.format(sys.version[:5]))
|
||||
@ -30,4 +32,5 @@ if __name__ == '__main__':
|
||||
logging.debug('ZeroMQ version: {}'.format(zmq.zmq_version()))
|
||||
logging.debug('PyZMQ version: {}'.format(zmq.pyzmq_version()))
|
||||
logging.info('Tornado application listening on port {}'.format(WEB_PORT))
|
||||
debug.watch_static_files()
|
||||
IOLoop.instance().start()
|
||||
|
Loading…
Reference in New Issue
Block a user