-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Doc] Update Vizro docs and example template #306
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,26 +32,29 @@ You can get started quickly using our [template repository](https://github.com/p | |
Your `app.py` should initialize the Vizro application as follows: | ||
|
||
```python | ||
import vizro as vm | ||
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) | ||
|
||
# Expose the Flask server to Gunicorn | ||
server = app.dash.server | ||
|
||
# Development server (optional) | ||
if __name__ == "__main__": | ||
app.run() | ||
``` | ||
|
||
2. Dependencies File (`requirements.txt`) | ||
|
||
List all Python packages required by your application. | ||
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 | ||
``` | ||
|
||
3. `Dockerfile` | ||
|
||
|
@@ -64,14 +67,14 @@ WORKDIR /app | |
|
||
# Install dependencies | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt gunicorn vizro | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy application files | ||
COPY . . | ||
|
||
# Configure the container | ||
EXPOSE 80 | ||
ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"] | ||
ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
``` | ||
|
||
## Testing locally | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
FROM python:3.11-slim | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This now matches the docs file exactly. |
||
|
||
# Set environment variables | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I could tell these weren't actually necessary for anything. e.g. |
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on | ||
|
||
# Set work directory | ||
WORKDIR /app | ||
|
||
# Install Python dependencies | ||
RUN pip install gunicorn | ||
# Install dependencies | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy project files | ||
# Copy application files | ||
COPY . . | ||
|
||
# Expose the port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure this should have been 80 all along? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's my error, the port 80 is also is exposed by the platform, so it didn't notice it |
||
EXPOSE 8000 | ||
|
||
# Run the application using Gunicorn | ||
ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"] | ||
# Configure the container | ||
EXPOSE 80 | ||
ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"] | ||
antonymilne marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
vizro==0.1.29 | ||
gunicorn==23.0.0 | ||
antonymilne marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. this is a small simplification Vizro offers over Dash/Flask - no need to explicitly expose the underlying server. The
app
object already acts as the WSGI server.