Here’s my rough project layout:
- /app (where the plotly dash app code goes)
- /assets (where the static files go)
- /components (where the component source files goes)
requirements.txt (where I define my python3 packages)
Makefile (what I use to build the project)
And here’s what I have so far as a Makefile (sorry about formatting):
. venv/bin/activate; cd components; npm run build; cd …; rm -rf apps/test; cp -r components/hello_world apps/test
. venv/bin/activate; black apps
. venv/bin/activate; python3 apps/server.py
test -d venv || virtualenv venv
. venv/bin/activate; pip3 install -Ur requirements.txt
rm -rf venv
find -iname “*.pyc” -delete
Ideally, I’d just run
make run and it would build my component, copy the products and run the server.
Firstly, is a Makefile the right tool and this a sensible project layout? If there is a better project structure, are there any “hello world” style examples that I can adopt that show how to setup a lightweight dash project with a custom component?
Secondly, when I try and import my new library (which I created from the cookiecutter example) I get a client-side “Error: x was not found.” error. Is this perhaps related to the way I copy the component build products across?