Skip to content

Commit

Permalink
Merge pull request #380 from afshin/autoreload
Browse files Browse the repository at this point in the history
Add --autoreload flag
  • Loading branch information
kevin-bates authored Jan 12, 2021
2 parents 4cf7d4d + 84ca636 commit add9743
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,16 @@ def start(self):
},
_("Set debug level for the extension and underlying server applications.")
)
flags['autoreload'] = (
{'ServerApp': {'autoreload': True}},
"""Autoreload the webapp
Enable reloading of the tornado webapp and all imported Python packages
when any changes are made to any Python src files in server or
extensions.
"""
)


# Add notebook manager flags
flags.update(boolean_flag('script', 'FileContentsManager.save_script',
'DEPRECATED, IGNORED',
Expand Down Expand Up @@ -644,6 +654,10 @@ def _default_log_format(self):
help=_("Whether to allow the user to run the server as root.")
)

autoreload = Bool(False, config=True,
help= ("Reload the webapp when changes are made to any Python src files.")
)

default_url = Unicode('/', config=True,
help=_("The default URL to redirect to from `/`")
)
Expand Down Expand Up @@ -1385,6 +1399,7 @@ def init_webapp(self):
if self.allow_origin_pat:
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat)
self.tornado_settings['allow_credentials'] = self.allow_credentials
self.tornado_settings['autoreload'] = self.autoreload
self.tornado_settings['cookie_options'] = self.cookie_options
self.tornado_settings['get_secure_cookie_kwargs'] = self.get_secure_cookie_kwargs
self.tornado_settings['token'] = self.token
Expand Down

0 comments on commit add9743

Please sign in to comment.