datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
80 stars 12 forks source link

Create composable Django project template #318

Closed hancush closed 1 month ago

hancush commented 1 year ago

Background

The contours of what's Django, what's Wagtail, and what's React/JavaScript blurry when you don't set it up yourself. Our current template management paradigm also requires us to have separate Django and Wagtail templates, which means we have to update things in two places.

Let's spend some time looking into options for a composable template that allows us to separate concerns, such that it's easier to learn what pieces of a project belong to what tool and we only have to make updates in one place.

Proposal

Research available approaches for composing templates into a single project; and pilot the one that looks best.

Deliverables

A composable Django project template. If we like it, we can adopt it and create one for vanilla JavaScript, as well.

Timeline

Two investment days.

hancush commented 1 year ago

I considered https://github.com/callowayproject/cookie-composer and https://github.com/pyscaffold/pyscaffoldext-cookiecutter, but the former is still in beta and the latter would require a more profound shift from our current practices.

Ultimately, after reading this thread, I decided to pursue an approach that uses one Cookiecutter template with subdirectories containing what we need for Django, React, and Wagtail, respectively, and a post_project_gen hook to rsync the included tools into the root project directory; concatenate READMEs, requirements, and Django settings; and remove the cruft. https://github.com/datamade/how-to/tree/hcg/composable-template/work-practices/project-templates

Entering into test phase now, but curious to hear feedback on this approach from the team.

smcalilly commented 8 months ago

The ultimate goal is one single Django template, with the option to include Wagtail. We'll decide what we need to do to accomplish this.

hancush commented 1 month ago

I have a renewed interest in this after fighting with the Wagtail cookiecutter. (Related #370)

Minimal app running Wagtail 6.1 here: https://github.com/datamade/tpc-ihs-noah-map/tree/ba9d491e8a6263d0395f7031075920599dc90860

hancush commented 1 month ago

Closing in favor of #371