Re:Django and React/Redux Boilerplate Project
by lfrodrigues on Monday August 28, 2017 @07:06AM
(#15115742)
Not saying it's the best/only approach but it made sense at the time. For example, Sentry does the same: https://github.com/getsentry/sentry/
Technically in Django you should put all the "static" into a static folder.
Re:Django and React/Redux Boilerplate Project
by senko on Monday August 28, 2017 @08:04AM
(#15115961)
Indeed, but what Django considers static assets are, with many modern frameworks, build results, not source itself. If you put all the UI bits inside static, you'll either service your JS source files, build config, node_modules and the like, or you'll need to muck around hiding those.
If instead you have a separate project diferctory for the UI bits and then just configure it to use the Django's static folder as the output dir (or alternatively, configure Django to to add the UI build folder in STATICFILES_DIRS), you avoid this pain.
My preferred solutions for this is having a layer above, so the structure looks like:
This is cleaner (different parts nicely separated), instantly recognizable to anyone working on one part but totally unfamiliar with the other, and allows you to use whichever scaffolding techniquies you want (eg cookiecutter on the backend, cli tools for react/vue/angular/whatever).