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
- Dynamic to Static Conversion: Converts Dash applications into static HTML sites with all necessary assets bundled.
- Downloadable Archive: Automatically packages the static site into a ZIP file for easy distribution.
- Self-Contained Static Site: Ensures all required assets (e.g., JavaScript, CSS) are included in the archive.
How to Use
-
Import the Library: Import the
dash2htmlfunction into your project.pip install dash2html
from dash import Dash from dash2html import dash2html
-
Set Up Your Dash Application: Create and configure your Dash app as you normally would.
-
Call
dash2html: Pass your Dash application instance and the desired port number to thedash2htmlfunction:from dash import Dash from your_library import dash2html app = Dash(__name__) # Define your app layout and callbacks here dash2html(app, port=8080)
-
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.
-
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.
- After the app is loaded, navigate to
Example Workflow
-
Run the Script:
python your_script.py -
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). -
Download Static Site: Navigate to
http://127.0.0.1:8080/download_zipin 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.zipin the current working directory.
Troubleshooting
-
No Content in ZIP: Ensure the Dash app has been loaded in the browser before accessing the
/download_zipendpoint. -
Port Already in Use: Change the
portparameter in thedash2htmlfunction 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)
| File | Size | Uploaded | |
|---|---|---|---|
| dash2html-1.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|