Created
November 26, 2014 18:16
-
-
Save anonymous/682a65934c31b0998d0d to your computer and use it in GitHub Desktop.
IPython Custom Launcher Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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