Skip to content

Commit b7b4080

Browse files
authored
[Doc] Update Vizro docs and example template (#306)
* Update docs and example template * Apply suggestions from code review
1 parent bf0e7f8 commit b7b4080

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

doc/apps/vizro.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,29 @@ You can get started quickly using our [template repository](https://github.com/p
3232
Your `app.py` should initialize the Vizro application as follows:
3333

3434
```python
35-
import vizro as vm
35+
import vizro.models as vm
3636
from vizro import Vizro
3737

3838
# Initialize your dashboard
39+
page = vm.Page(...)
3940
dashboard = vm.Dashboard(pages=[page])
4041

4142
# Create the application instance
4243
app = Vizro().build(dashboard)
4344

44-
# Expose the Flask server to Gunicorn
45-
server = app.dash.server
46-
4745
# Development server (optional)
4846
if __name__ == "__main__":
4947
app.run()
5048
```
5149

5250
2. Dependencies File (`requirements.txt`)
5351

54-
List all Python packages required by your application.
52+
List all Python packages required by your application. These should include pinned versions of `vizro` and `gunicorn`:
53+
54+
```
55+
vizro==0.1.29
56+
gunicorn==23.0.0
57+
```
5558

5659
3. `Dockerfile`
5760

@@ -64,14 +67,14 @@ WORKDIR /app
6467

6568
# Install dependencies
6669
COPY requirements.txt .
67-
RUN pip install --no-cache-dir -r requirements.txt gunicorn vizro
70+
RUN pip install --no-cache-dir -r requirements.txt
6871

6972
# Copy application files
7073
COPY . .
7174

7275
# Configure the container
7376
EXPOSE 80
74-
ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"]
77+
ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"]
7578
```
7679

7780
## Testing locally

examples/docker/vizro/Dockerfile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
FROM python:3.11-slim
22

3-
# Set environment variables
4-
ENV PYTHONUNBUFFERED=1 \
5-
PYTHONDONTWRITEBYTECODE=1 \
6-
PIP_NO_CACHE_DIR=off \
7-
PIP_DISABLE_PIP_VERSION_CHECK=on
8-
9-
# Set work directory
103
WORKDIR /app
114

12-
# Install Python dependencies
13-
RUN pip install gunicorn
5+
# Install dependencies
146
COPY requirements.txt .
157
RUN pip install --no-cache-dir -r requirements.txt
168

17-
# Copy project files
9+
# Copy application files
1810
COPY . .
1911

20-
# Expose the port
21-
EXPOSE 8000
22-
23-
# Run the application using Gunicorn
24-
ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"]
12+
# Configure the container
13+
EXPOSE 80
14+
ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"]

examples/docker/vizro/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
dashboard = vm.Dashboard(pages=[page])
1919
app = Vizro().build(dashboard)
20-
server = app.dash.server
2120

2221
if __name__ == "__main__":
2322
app.run()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
vizro==0.1.29
2+
gunicorn==23.0.0

0 commit comments

Comments
 (0)