Hosting Dash Applications in Grace
Overview
Grace allows you to host applications such as React or Dash apps. This guide walks through the steps of developing a simple Dash application and hosting it on the Grace platform.
User Guide
Step 1: Prepare Your Dash App
- In your workspace, create a project folder (e.g., test_app).
- Inside the folder, create two files:
- app.py – contains the Dash app code.
- requirements.txt – lists the Python packages required to run the app.
- Example Setup
- app.py:
- Minimal Dash code (e.g., sample from the Dash Plotly website).
- Must specify: server instance,
debug=True, andport=5080.
- requirements.txt:
- dash
- plotly
- numpy
- app.py:
- Tip: Pin package versions to avoid conflicts (e.g.,
dash==2.11.1).
Step 2: Test Your App Locally
- Before hosting on Grace:
- Use Visual Studio Code (connected to Grace) to run and debug your app.
- Ensure the app functions as expected locally.
Step 3: Create a Snapshot in Grace
- Navigate to MLOps → Applications from the side ribbon.
- Go to the Snapshots tab.
- Click Create Snapshot.
- Select the test_app folder.
- Choose Application Type: Dash (or React if applicable).
- Provide a name (e.g., test_123).
- Select a runtime image: e.g., Dash Python 3.11.
- Version = 1.
- Optional settings:
- Debug Mode – useful for auto-refresh during code changes.
- Long-Running Callbacks – prevents timeout issues for heavy workloads.
- Click Prepare to build the snapshot.
Step 4: Deploy the Application
- Once the snapshot is ready, click Deploy.
- Configure deployment options:
- Select the snapshot.
- Assign a name to the application.
- Choose resources (CPU type, memory).
- (Optional) Add identification token or user authentication.
- Click Deploy.
Step 5: Access the Hosted App
- Once deployment finishes, click the URL provided.
- The app opens in your browser and is now hosted on Grace.
Summary
| Step | Description |
|---|---|
| Prepare App | Create app.py and requirements.txt with Dash code & dependencies |
| Test Locally | Run in VS Code before hosting |
| Create Snapshot | Define app type, runtime, version, debug/long-running options |
| Deploy Application | Allocate resources, authentication, and launch the app |
| Access App | Use the provided URL to interact with the hosted Dash application |
Next Steps
- Extend your Dash app to include interactive dashboards or machine learning models.
- Use Grace’s deployment features for scaling apps and handling real-world workloads.