From 35cd13953e0a717b115c167dedaedfba73ea76fc Mon Sep 17 00:00:00 2001 From: Jitendra Gundaniya Date: Mon, 7 Oct 2024 11:39:34 +0100 Subject: [PATCH] Updated build related docs Signed-off-by: Jitendra Gundaniya --- ...latform_agnostic_sharing_with_kedro_viz.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/source/platform_agnostic_sharing_with_kedro_viz.md b/docs/source/platform_agnostic_sharing_with_kedro_viz.md index 228e875d42..c9092e1432 100644 --- a/docs/source/platform_agnostic_sharing_with_kedro_viz.md +++ b/docs/source/platform_agnostic_sharing_with_kedro_viz.md @@ -46,6 +46,32 @@ Starting from Kedro-Viz 9.2.0, `kedro viz build` will not include dataset previe This creates a `build` folder containing your Kedro-Viz app package in your project directory. +## Running Kedro-Viz Locally + +When you generate build folder with the command `kedro viz build`, it creates a build directory with an `index.html` file, which is the entry point for visualizing your pipeline. However, simply opening `index.html` using the file protocol `file://` is not supported due to Cross-Origin Resource Sharing Policy in modern browsers. + +### Using a Local Server + +To view your pipeline visualization correctly, you need to serve `index.html` using an HTTP server. Here are a few simple ways to do this: + +1. Python's Built-in HTTP Server: + - Navigate to the build directory and run: + ```bash + python -m http.server + ``` + - This starts a web server at `http://localhost:8000`, which you can use to view index.html. + +2. Node's http-server: + - First, install it globally: + ```bash + npm install -g http-server + ``` + - Then, run it from the build directory: + ```bash + http-server + ``` + + ## Static website hosting platforms such as GitHub Pages Follow the steps [listed in the GitHub pages documentation](https://docs.github.com/en/pages/quickstart) to create a Git repository that supports GitHub Pages. On completion, push the contents of the previously created `build` folder to this new repository. Your site will be available at the following URL: `http://.github.io`