Show More
@@ -1,9 +1,8 | |||||
1 | """Base Tornado handlers for the notebook server.""" |
|
1 | """Serve files directly from the ContentsManager.""" | |
2 |
|
2 | |||
3 | # Copyright (c) IPython Development Team. |
|
3 | # Copyright (c) IPython Development Team. | |
4 | # Distributed under the terms of the Modified BSD License. |
|
4 | # Distributed under the terms of the Modified BSD License. | |
5 |
|
5 | |||
6 | import logging |
|
|||
7 | import os |
|
6 | import os | |
8 | import mimetypes |
|
7 | import mimetypes | |
9 | import json |
|
8 | import json | |
@@ -11,11 +10,6 import base64 | |||||
11 |
|
10 | |||
12 | from tornado import web |
|
11 | from tornado import web | |
13 |
|
12 | |||
14 | try: |
|
|||
15 | from tornado.log import app_log |
|
|||
16 | except ImportError: |
|
|||
17 | app_log = logging.getLogger() |
|
|||
18 |
|
||||
19 | from IPython.html.base.handlers import IPythonHandler |
|
13 | from IPython.html.base.handlers import IPythonHandler | |
20 |
|
14 | |||
21 | class FilesHandler(IPythonHandler): |
|
15 | class FilesHandler(IPythonHandler): | |
@@ -49,3 +43,6 class FilesHandler(IPythonHandler): | |||||
49 | self.write(model['content']) |
|
43 | self.write(model['content']) | |
50 | self.flush() |
|
44 | self.flush() | |
51 |
|
45 | |||
|
46 | default_handlers = [ | |||
|
47 | (r"/files/(.*)", FilesHandler), | |||
|
48 | ] No newline at end of file |
@@ -34,8 +34,6 from jinja2 import Environment, FileSystemLoader | |||||
34 | from zmq.eventloop import ioloop |
|
34 | from zmq.eventloop import ioloop | |
35 | ioloop.install() |
|
35 | ioloop.install() | |
36 |
|
36 | |||
37 | from IPython.html.files.handlers import FilesHandler |
|
|||
38 |
|
||||
39 | # check for tornado 3.1.0 |
|
37 | # check for tornado 3.1.0 | |
40 | msg = "The IPython Notebook requires tornado >= 3.1.0" |
|
38 | msg = "The IPython Notebook requires tornado >= 3.1.0" | |
41 | try: |
|
39 | try: | |
@@ -188,6 +186,7 class NotebookWebApplication(web.Application): | |||||
188 | handlers.extend(load_handlers('tree.handlers')) |
|
186 | handlers.extend(load_handlers('tree.handlers')) | |
189 | handlers.extend(load_handlers('auth.login')) |
|
187 | handlers.extend(load_handlers('auth.login')) | |
190 | handlers.extend(load_handlers('auth.logout')) |
|
188 | handlers.extend(load_handlers('auth.logout')) | |
|
189 | handlers.extend(load_handlers('files.handlers')) | |||
191 | handlers.extend(load_handlers('notebook.handlers')) |
|
190 | handlers.extend(load_handlers('notebook.handlers')) | |
192 | handlers.extend(load_handlers('nbconvert.handlers')) |
|
191 | handlers.extend(load_handlers('nbconvert.handlers')) | |
193 | handlers.extend(load_handlers('kernelspecs.handlers')) |
|
192 | handlers.extend(load_handlers('kernelspecs.handlers')) | |
@@ -198,9 +197,6 class NotebookWebApplication(web.Application): | |||||
198 | handlers.extend(load_handlers('services.nbconvert.handlers')) |
|
197 | handlers.extend(load_handlers('services.nbconvert.handlers')) | |
199 | handlers.extend(load_handlers('services.kernelspecs.handlers')) |
|
198 | handlers.extend(load_handlers('services.kernelspecs.handlers')) | |
200 | handlers.append( |
|
199 | handlers.append( | |
201 | (r"/files/(.*)", FilesHandler), |
|
|||
202 | ) |
|
|||
203 | handlers.append( |
|
|||
204 | (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}), |
|
200 | (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}), | |
205 | ) |
|
201 | ) | |
206 | # set the URL that will be redirected from `/` |
|
202 | # set the URL that will be redirected from `/` |
General Comments 0
You need to be logged in to leave comments.
Login now