From 28829b2524da39fc0a54585dcf60868959db3ba4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 23 Mar 2016 12:55:45 -0500 Subject: [PATCH] Fix webpack static file configuration --- notebook/lab/handlers.py | 7 ++++--- notebook/{static => }/lab/index.js | 0 notebook/{static => }/lab/package.json | 0 notebook/{static => }/lab/webpack.conf.js | 5 +++-- notebook/templates/lab.html | 2 +- setupbase.py | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) rename notebook/{static => }/lab/index.js (100%) rename notebook/{static => }/lab/package.json (100%) rename notebook/{static => }/lab/webpack.conf.js (93%) diff --git a/notebook/lab/handlers.py b/notebook/lab/handlers.py index d776e38ce..610e27b62 100644 --- a/notebook/lab/handlers.py +++ b/notebook/lab/handlers.py @@ -3,8 +3,9 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. +import os from tornado import web -from ..base.handlers import IPythonHandler +from ..base.handlers import IPythonHandler, AuthenticatedFileHandler class LabHandler(IPythonHandler): @@ -18,12 +19,12 @@ class LabHandler(IPythonHandler): terminals_available=self.settings['terminals_available'], mathjax_url=self.mathjax_url)) - #----------------------------------------------------------------------------- # URL to handler mappings #----------------------------------------------------------------------------- - default_handlers = [ (r"/lab", LabHandler), + (r"/lab/build/(.*)", AuthenticatedFileHandler, + {'path': os.path.join(os.path.dirname(__file__), 'build')}), ] diff --git a/notebook/static/lab/index.js b/notebook/lab/index.js similarity index 100% rename from notebook/static/lab/index.js rename to notebook/lab/index.js diff --git a/notebook/static/lab/package.json b/notebook/lab/package.json similarity index 100% rename from notebook/static/lab/package.json rename to notebook/lab/package.json diff --git a/notebook/static/lab/webpack.conf.js b/notebook/lab/webpack.conf.js similarity index 93% rename from notebook/static/lab/webpack.conf.js rename to notebook/lab/webpack.conf.js index 9538df3d5..a1d34cad0 100644 --- a/notebook/static/lab/webpack.conf.js +++ b/notebook/lab/webpack.conf.js @@ -7,8 +7,9 @@ var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin"); module.exports = { entry: './index.js', output: { - path: './build', - filename: 'bundle.js' + path: __dirname + "/build", + filename: "bundle.js", + publicPath: "lab/build/" }, node: { fs: "empty" diff --git a/notebook/templates/lab.html b/notebook/templates/lab.html index a94b96137..d7028a3c3 100644 --- a/notebook/templates/lab.html +++ b/notebook/templates/lab.html @@ -95,7 +95,7 @@ "wsUrl": "{{ws_url| urlencode}}", "notebookPath": "{{notebook_path | urlencode}}" } - + {% endblock %} diff --git a/setupbase.py b/setupbase.py index bfe3c0f2a..97249d3bb 100644 --- a/setupbase.py +++ b/setupbase.py @@ -131,7 +131,7 @@ def find_package_data(): ]) # Add the Lab page contents - static_data.append(pjoin('static', 'lab', 'build', '*')) + static_data.append(pjoin('lab', 'build', '*')) components = pjoin("static", "components") # select the components we actually need to install @@ -341,7 +341,7 @@ class JavascriptDependencies(Command): bower_dir = pjoin(static, 'components') node_modules = pjoin(repo_root, 'node_modules') - lab_dir = pjoin(repo_root, 'notebook', 'static', 'lab') + lab_dir = pjoin(repo_root, 'notebook', 'lab') def run(self): try: