def configure_notebook(self):
"""Setup pyramid_notebook integration."""
# Check if we have IPython installed
try:
pkg_resources.get_distribution('IPython[notebook]')
except pkg_resources.DistributionNotFound:
return
try:
import websauna.system.notebook.views
import websauna.system.notebook.adminviews
import websauna.system.notebook.subscribers
except ImportError:
# Have installed IPython[Notebook], but not pyramid_notebook
return
self.config.add_route('admin_shell', '/notebook/admin-shell')
self.config.add_route('shutdown_notebook', '/notebook/shutdown')
self.config.add_route('notebook_proxy', '/notebook/*remainder')
self.config.scan(websauna.system.notebook.views)
self.config.scan(websauna.system.notebook.adminviews)
self.config.scan(websauna.system.notebook.subscribers)
self.config.registry.features.add("notebook")
评论列表
文章目录