Skip to main content

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

Metadata

Release files for dash2html 1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dash2html 1
File Size Uploaded
dash2html-1.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dash2html 1
File Interpreter ABI Platform
dash2html-1-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / dash2html-1.tar.gz

Download URL dash2html-1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2e96257bebeb5dda745d623d9f24ed47343a9959788a40a829a7dac09017e0fa
BLAKE2b-256 checksum
How to use checksums
2988bf4065049152a9348e4e78f7786e21620a9e4bdd8af6031588f3edd789cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / dash2html-1-py3-none-any.whl

Download URL dash2html-1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
483be71b20edefd36553088ac5ee078fff641f66caea8565909de45a2937a0a1
BLAKE2b-256 checksum
How to use checksums
1fcc62cee098d2555ef37338ab2b947f41e254ca52d66d2f2beb825f6dc10dd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page