Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Django React Redux JWT Base Project (github.com/seedstars)
38 points by lfrodrigues on Feb 16, 2016 | hide | past | favorite | 26 comments


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.


right! you can't just put JWT in there. I saw that and was like...maybe we went too far? hehe


Hey, I'm the developer. I've corrected the readme. Thanks!


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.

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...


You're right. I copy pasted some code from some projects to build this generic one. A colleague will fix it in a few minutes :)


Including the 'accounts' app is actually pretty useful. Then even a newcomer to react and redux can see how the front and back end are hooked up.

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...


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?


well for development that's a good idea. For production you don't want to have webpack serving anything, you want it compiled, right?


That's what I do. Webpack compiles to the static/ dir and Django serves the static files in that dir. I don't know how/why you would do it otherwise.


For fast development iterations, running webpack's own web server is used for development.

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.


This sounds horrifying, less is more.


Make things as simple as possible, but no simpler

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.


At first glance I thought it was a parody and looked if both Angular and React were included.


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.



Does this render all the React content server-side first? I wasn't able to figure out from an initial glance through the files.


No. I was looking for that too.

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...


This was exactly our analysis. Since most of our apps don't need to be isomorphic/universal we didn't pursue this avenue.


No it does not, it serves a index.html with react/css.


You could put all of this into Vagrant or Otto with a bash file to set up the dependencies to get it going.


Ugh! Blah. Spit.


Which particular religious faction involved in this are you railing against?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: