As I have described previously in the context of R projects, I love structured projects the same way I like my room cleaned: I desire, nay, need a nice, clean desk, I just hate tidying it. I am much the same way with Dash applications. Plotly’s Dash is a fantastic tool for generating interactive data-driven experiences, and I have found that having a great starter template that takes care of most of my concerns gets me to developing Dash apps much faster. That’s why I built cookiecutter-dash
, a quick and easy Dash project generator.
Building your first Dash app with cookiecutter-dash
To generate your Dash project boilerplate, you will need cookiecutter, a Python-based project templating engine. You can install it using pip, on your system installation of Python or your installation of choice. Once you have installed cookiecutter, you can use it to generate a Dash app skeleton by calling
cookiecutter https://github.com/chrisvoncsefalvay/cookiecutter-dash
This will ask a series of questions. Answering them will help configure the Dash app. Once the app skeleton is built, you have a fully functional app skeleton you can use to get started. The Dash app skeleton has Bootstrap integrated and a header nav pre-defined for a quick start, as well as a gold-standard folder structure (separate folders for data
, components
and assets
), but is flexible enough for you to adjust to your liking.
Deploying your Dash app
The project is designed to work well with Dockerized deployment, e.g. on AWS Elastic Container Service, as described in this post. The included Dockerfile
is ready for use as long as all dependencies are in the requirements.txt
file. If you have additional local dependencies, you might have to copy the gzipped dependency onto the server and execute a local pip
install (use COPY
in the Dockerfile
to copy the dependency to the image and RUN pip3 install /tmp/<name of gzipped package>
to install it).
Issues and further development
cookiecutter-dash
currently lives on Github – you can check out the repository here, and comments, suggestions or feature requests/issues are always welcome. I intend to keep cookiecutter-dash
relatively opinionated (e.g. I did not include a Procfile
for Heroku deployment) in order to be able to quickly whip up a Dash app skeleton, but I always welcome suggestions for how it can be made more efficient.