Skip to content

Commit

Permalink
Merge pull request #20 from ImperialCollegeLondon/improve-dash
Browse files Browse the repository at this point in the history
Improve dash
  • Loading branch information
AdrianDAlessandro authored Feb 13, 2023
2 parents 72c85ff + 64d3975 commit 3aa9040
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM python:3.9-slim
COPY ./dash/requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY ./dash/ ./
CMD gunicorn -b 0.0.0.0:8050 app:server
CMD gunicorn --reload -b 0.0.0.0:8050 app.app:server
6 changes: 5 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def generate_docker_compose(template_file, ip):

# Add the dash app to to docker-compose.yml file
logging.info(f"Adding dash app to docker-compose.yml...")
docker_compose["services"]["dash"] = {"build": ".", "ports": ["8050:8050"]}
docker_compose["services"]["dash"] = {
"build": ".",
"ports": ["8050:8050"],
"volumes": ["./dash:/app"],
}

# Configure logging for nginx
logging.info(f"Adding volume for nginx logs...")
Expand Down
6 changes: 4 additions & 2 deletions dash/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
app = Dash(__name__, use_pages=True, update_title=None)

app.layout = html.Div(
[
style={"backgroundColor": "#F9F9F9"},
children=[
html.H1("Multi-page app with Dash Pages"),
html.Div(
[
Expand All @@ -17,7 +18,8 @@
]
),
dash.page_container,
]
html.H2("Footer", style={"float": "right", "backgroundColor": "#F9F9F9"}),
],
)

server = app.server
Expand Down
3 changes: 2 additions & 1 deletion dash/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
dash.register_page(__name__, path="/")

layout = html.Div(
style={"backgroundColor": "#F9F9F9"},
children=[
html.H1(children="This is our Home page"),
html.Div(
children="""
This is our Home page content.
"""
),
]
],
)

0 comments on commit 3aa9040

Please sign in to comment.