Skip to content

Commit 4bc3234

Browse files
mono-repo skeleton
0 parents  commit 4bc3234

File tree

10 files changed

+53
-0
lines changed

10 files changed

+53
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vv/
2+
*.pyc

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Dash Sample Apps

app.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"scripts": {
3+
"dokku": {
4+
"predeploy": "python predeploy.py"
5+
}
6+
}
7+
}

apps/__init__.py

Whitespace-only changes.

apps/simple/DOKKU_SCALE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web=1

apps/simple/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn apps.simple.app:server

apps/simple/__init__.py

Whitespace-only changes.

apps/simple/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import dash
2+
import dash_html_components as html
3+
from shared_code import hello
4+
5+
hello()
6+
7+
app = dash.Dash(__name__)
8+
server = app.server
9+
10+
app.layout = html.Div([
11+
html.H1('Simple')
12+
])

apps/simple/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dash
2+
gunicorn

predeploy.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from os import listdir, environ
2+
from os.path import isfile, join
3+
import shutil
4+
import subprocess
5+
6+
app_path = "apps"
7+
8+
# Read apps directory
9+
app_dir_names = [f for f in listdir(app_path) if isfile(join(app_path, f))]
10+
11+
# DDS provides DASH_APP_NAME variable
12+
app_name = environ["DASH_APP_NAME"]
13+
14+
# It should match one of the directory names
15+
# We assume directory name == App Name
16+
if app_name not in app_dir_names:
17+
raise Exception(
18+
"App name {} not found in {} directory - the names must match".format(
19+
app_name, app_path
20+
)
21+
)
22+
23+
files = ["requirements.txt", "Procfile", "DOKKU_SCALE"]
24+
for f in files:
25+
shutil.copyfile(join("apps", app_name, f), f)
26+
27+
subprocess.run("python -m pip install -r requirements.txt".split(" "))

0 commit comments

Comments
 (0)