Skip to main content

Convert Plotly Dash App To Static HTML File

Project description

Dash2HTML Library

Overview

The dash2html library provides a convenient way to convert a Dash web application into a static HTML site. This library enables developers to host static versions of their Dash applications, making them accessible without requiring a running server.


Features

  1. Dynamic to Static Conversion: Converts Dash applications into static HTML sites with all necessary assets bundled.
  2. Downloadable Archive: Automatically packages the static site into a ZIP file for easy distribution.
  3. Self-Contained Static Site: Ensures all required assets (e.g., JavaScript, CSS) are included in the archive.

How to Use

  1. Import the Library: Import the dash2html function into your project.

    pip install dash2html
    
    from dash import Dash
    from dash2html import dash2html
    
  2. Set Up Your Dash Application: Create and configure your Dash app as you normally would.

  3. Call dash2html: Pass your Dash application instance and the desired port number to the dash2html function:

    from dash import Dash
    from your_library import dash2html
    
    app = Dash(__name__)
    # Define your app layout and callbacks here
    
    dash2html(app, port=8080)
    
  4. Access the Application:

    • Start the server by running your script.
    • Visit the URL displayed in the console (e.g., http://127.0.0.1:8080) to load the app.
  5. Download the Static Site:

    • After the app is loaded, navigate to http://127.0.0.1:8080/download_zip.
    • The static site will be packaged into a ZIP file and downloaded.

Example Workflow

  1. Run the Script:

    python your_script.py
    
  2. Visit the Dash App: Open the app in your browser using the URL provided in the console (e.g., http://127.0.0.1:8080).

  3. Download Static Site: Navigate to http://127.0.0.1:8080/download_zip in your browser to download the ZIP file.


Notes

  • Ensure that the Dash application is running and fully loaded in your browser before downloading the static site.
  • The static site will be packaged as static_site.zip in the current working directory.

Troubleshooting

  • No Content in ZIP: Ensure the Dash app has been loaded in the browser before accessing the /download_zip endpoint.

  • Port Already in Use: Change the port parameter in the dash2html function to an available port.


Acknowledgments

Inspired by Ref code Created by Sheth Jenil

Project details


Release history Release notifications | RSS feed

This version

1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dash2html-1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dash2html-1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file dash2html-1.tar.gz.

File metadata

  • Download URL: dash2html-1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dash2html-1.tar.gz
Algorithm Hash digest
SHA256 2e96257bebeb5dda745d623d9f24ed47343a9959788a40a829a7dac09017e0fa
MD5 7d983aa1249e89486f47383ea5bf1afc
BLAKE2b-256 2988bf4065049152a9348e4e78f7786e21620a9e4bdd8af6031588f3edd789cd

See more details on using hashes here.

File details

Details for the file dash2html-1-py3-none-any.whl.

File metadata

  • Download URL: dash2html-1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dash2html-1-py3-none-any.whl
Algorithm Hash digest
SHA256 483be71b20edefd36553088ac5ee078fff641f66caea8565909de45a2937a0a1
MD5 34c3afe883cf976f8d67f6efefaec044
BLAKE2b-256 1fcc62cee098d2555ef37338ab2b947f41e254ca52d66d2f2beb825f6dc10dd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page