Vizro#
To deploy a Vizro application you need a Ploomber Cloud account.
Project Structure#
Your deployment package must include these three essential files:
app.py
- Main application filerequirements.txt
- Python dependenciesDockerfile
- Container configuration
Note
You can get started quickly using our template repository
Application Setup#
Main Application File (
app.py
)
Your app.py
should initialize the Vizro application as follows:
import vizro.models as vm
from vizro import Vizro
# Initialize your dashboard
page = vm.Page(...)
dashboard = vm.Dashboard(pages=[page])
# Create the application instance
app = Vizro().build(dashboard)
# Development server (optional)
if __name__ == "__main__":
app.run()
Dependencies File (
requirements.txt
)
List all Python packages required by your application. These should include pinned versions of vizro
and gunicorn
:
vizro==0.1.29
gunicorn==23.0.0
Dockerfile
Create a Dockerfile
with this configuration:
FROM python:3.11-slim
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY . .
# Configure the container
EXPOSE 80
ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"]
Testing locally#
Before deployment, test your application locally using Docker:
# build the docker image
docker build . -t vizro-app
# run it
docker run -p 5000:80 vizro-app
Now, open http://0.0.0.0:5000/ to see your app.
Once running, access your application at http://localhost:5000
Deploy#
Deployment Process
Zip all project files (
app.py
,requirements.txt
,Dockerfile
, and any additional resources)Log in to Ploomber Cloud
Navigate to the deployment menu
Select the Docker deployment option
Upload your zip file
Tip
To ensure your app doesn’t break on re-deployments, pin your dependencies.