问题
I have a Django aplication (+REST framework) with pluggable Django apps (which are discovered using distutils' entry points, and can be developed independetly from each other, and installed via pip). This works well so far.
The main app should provide a basic index.html which dynamically loads React components, and each app should be possible to add React components as plugins, which are combined on the frontend then.
But: How the heck am I supposed to place my client directories into each app, so that they are found for collecting all the static files?
Should I put a react app into /my-app1/client
and /my-app2/client
?
my-application/
core-app/
client/
react files etc
static/
models.py
...
plugin-app1/
client/
react files etc
static/
models.py
...
And tell Webpack/brunch/whatever to compile all the css/js etc files into /my-app1/static
, followed by ./manage.py collectstatic
then?
Is there a better approach to collect distributed react "plugin" in dfferent Django apps into one static directory? Can brunch.io do this? Webpack? Another? Own script?
It would be nice to have something like brunch watch
- to have hot-updated all changed files instantly. This works for one directory, but not for a distributed net of plugin directories, right?
Or is this completely thought wrong? Please help.
来源:https://stackoverflow.com/questions/50796398/multiple-django-apps-with-each-having-a-react-frontend