Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --autoreload flag #380

Merged
merged 1 commit into from
Jan 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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