Skip to content

Instantly share code, notes, and snippets.

Created November 26, 2014 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/682a65934c31b0998d0d to your computer and use it in GitHub Desktop.
Save anonymous/682a65934c31b0998d0d to your computer and use it in GitHub Desktop.
IPython Custom Launcher Example
import sys
import os
import IPython
from IPython.html import notebookapp
join = lambda *x: os.path.realpath(os.path.join(*x))
join_dir = lambda f, *x: join(os.path.dirname(f), *x)
def start(*args):
app = notebookapp.NotebookApp()
app.tornado_settings.update(
template_path=[
join_dir(__file__, "my-custom-templates"),
join_dir(notebookapp.__file__, "templates"),
join_dir(notebookapp.__file__) ## load it twice, so you can extend `templates/`
]
)
app.extra_static_paths = [
join_dir(__file__, "my-custom-static")
]
app.initialize((
"--notebook-dir", "/my-custom-starting-dir"
# other configuration
) + args)
app.start()
if __name__ == "__main__":
start(*sys.argv[1:])
<!-- this would go in `my-custom-templates` -->
% extends "templates/page.html" %}
{% block logo %}
<img src='{{static_url("logo.svg") }}' alt='My Custom Notebook Experience'/>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment