Skip to content

Commit add9743

Browse files
authored
Merge pull request #380 from afshin/autoreload
Add --autoreload flag
2 parents 4cf7d4d + 84ca636 commit add9743

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jupyter_server/serverapp.py

+15
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,16 @@ def start(self):
530530
},
531531
_("Set debug level for the extension and underlying server applications.")
532532
)
533+
flags['autoreload'] = (
534+
{'ServerApp': {'autoreload': True}},
535+
"""Autoreload the webapp
536+
Enable reloading of the tornado webapp and all imported Python packages
537+
when any changes are made to any Python src files in server or
538+
extensions.
539+
"""
540+
)
541+
542+
533543
# Add notebook manager flags
534544
flags.update(boolean_flag('script', 'FileContentsManager.save_script',
535545
'DEPRECATED, IGNORED',
@@ -644,6 +654,10 @@ def _default_log_format(self):
644654
help=_("Whether to allow the user to run the server as root.")
645655
)
646656

657+
autoreload = Bool(False, config=True,
658+
help= ("Reload the webapp when changes are made to any Python src files.")
659+
)
660+
647661
default_url = Unicode('/', config=True,
648662
help=_("The default URL to redirect to from `/`")
649663
)
@@ -1385,6 +1399,7 @@ def init_webapp(self):
13851399
if self.allow_origin_pat:
13861400
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat)
13871401
self.tornado_settings['allow_credentials'] = self.allow_credentials
1402+
self.tornado_settings['autoreload'] = self.autoreload
13881403
self.tornado_settings['cookie_options'] = self.cookie_options
13891404
self.tornado_settings['get_secure_cookie_kwargs'] = self.get_secure_cookie_kwargs
13901405
self.tornado_settings['token'] = self.token

0 commit comments

Comments
 (0)