For real world projects you end up needing a fair bit of stuff. I'm using a pretty similar stack and once you are up and running the majority of it falls into the background and your day to day work generally involves working only with an easy to use top layer.
Excellent. I look forward to seeing your assembly language web framework.
Joking aside - I'm actually going to call you out on a throwaway, crown-pleasing comment. You'd please the crowd a lot less if you added more detail as everyone would suddenly discover their sweet spot in the 'roll your own vs re-use' wars didn't coincide with yours.
It's a little like standing on a soap box and shouting "freedom!". Everyone can get behind a content-free message.
Very niche, but if you need it this could definitely save you a few hours. I wish I had this last weekend for a hackathon where I used a stack very similar to this. I spent longer than I should have to get webpack up and running with Django.
Silly question, but can't you run Django to serve your backend API, and Webpack to serve your static assets including javascript, then use an http proxy like Nginx to serve them under the same url?
Note: JWT is JSON Web Token in this case, not Java Web Toolkit. This was very confusing to me as JWT is only mentioned in the title but not anywhere else in the README.
Not sure why the `accounts` app is included [0]. As seen from the comments [1] in the `models.py` it looks like it's from an existing project, don't think this should be in a boilerplate project.
Some prior work on that front is: https://github.com/markfinger/python-webpack --- requires a node.js server to run in tandem. Tried it a couple of months ago, and worked, but not sure how it will handle lots of load...
Great work, I've been enjoying using this exact stack recently - this has definitely taught me a few things.
The main thing I'm still trying to get my head round with React/Redux/Router is where in the lifecycle to do data fetching - I noticed you're doing it in componentWillMount, when the React docs suggest componentDidMount, and I've seen others do it in various other ways with no clear indication what the 'best practice' approach is.
I understand your thoughts and normally we follow the React docs suggestions for generic components. We place data fetching code in componentWillMount in those cases we want to win some time, but if it's not the case I would recommend to place it in componentDidMount as React docs suggests.
What would be the best way to include some form of web sockets server/realtime pub-sub into this á la Socket.io? What's the best way to do this in Django? I feel this is an important component of any new modern web project, but it seems to be ignored here.
27 comments
[ 5.4 ms ] story [ 68.5 ms ] threadFor real world projects you end up needing a fair bit of stuff. I'm using a pretty similar stack and once you are up and running the majority of it falls into the background and your day to day work generally involves working only with an easy to use top layer.
Joking aside - I'm actually going to call you out on a throwaway, crown-pleasing comment. You'd please the crowd a lot less if you added more detail as everyone would suddenly discover their sweet spot in the 'roll your own vs re-use' wars didn't coincide with yours.
It's a little like standing on a soap box and shouting "freedom!". Everyone can get behind a content-free message.
Where django would instead load a custom JS endpoint in development, and use the compiled file for production.
Webpack static compile each time is just way to slow— I've seen it take 60+seconds to compile.
Nevertheless, nice boilerplate project :).
[0] https://github.com/Seedstars/django-react-redux-jwt-base/tre...
[1] https://github.com/Seedstars/django-react-redux-jwt-base/blo...
I'd encourage anyone to look at these files:
Auth action (which depends on the accounts app and DRF): https://github.com/Seedstars/django-react-redux-jwt-base/blo...
Auth Reducer (which changes redux state based on the outcome of login/logout actions): https://github.com/Seedstars/django-react-redux-jwt-base/blo...
Some prior work on that front is: https://github.com/markfinger/python-webpack --- requires a node.js server to run in tandem. Tried it a couple of months ago, and worked, but not sure how it will handle lots of load...
The main thing I'm still trying to get my head round with React/Redux/Router is where in the lifecycle to do data fetching - I noticed you're doing it in componentWillMount, when the React docs suggest componentDidMount, and I've seen others do it in various other ways with no clear indication what the 'best practice' approach is.