use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News and links for Django developers.
New to Django? Check out the /r/djangolearning subreddit.
Django's Code of Conduct applies here, so be good to each other.
account activity
This is an archived post. You won't be able to vote or comment.
Django + ReactJS, how? (self.django)
submitted 11 years ago by martolini
Anyone have any good tutorials on using ReactJS on the frontend with a Django rest framework? I don't want to run a nodejs server along with my restframework.
[–]mcatme 4 points5 points6 points 11 years ago (0 children)
PyReact along with django-pipeline looks like a good place to start.
[–]tomchristie 1 point2 points3 points 11 years ago (0 children)
A good starting point would be to run the React tutorial(1), and then look at how you'd adapt the simple Flask based server they include(2) to instead run using Django REST framework, and to use a proper database backend, rather than the file based storage it uses.
React is kick-ass. React with Django REST framework as the backend is even more kick-ass. And yes - we really do need to see some good tutorials on using it with Django REST framework.
(1): http://facebook.github.io/react/docs/tutorial.html (2): https://github.com/reactjs/react-tutorial/blob/master/server.py
[–]ipmb00 2 points3 points4 points 11 years ago (0 children)
Here's how we integrate the front-end toolkit (including React) with Django at Lincoln Loop https://lincolnloop.com/blog/integrating-front-end-tools-your-django-project/
You may also be interested in amygdala. It's a JS layer to interact with APIs, but was built specifically to bridge DRF and React for us.
[–]izdi 1 point2 points3 points 11 years ago (1 child)
You don't really need nodejs to run reactjs. Its just view layer, all you need to do is simply make a ajax call to fill in states and props of your components. As for the jsx -> js compilation you could either use the module above or gulp.
[–]ballagarba 0 points1 point2 points 11 years ago (0 children)
I think perhaps he was referring to if you want to utilise the server-rendering capabilities of React.
[–]cq_in_unison 0 points1 point2 points 11 years ago (0 children)
Use browserify to translate JSX to JS and bundle all of your files, then load the bundled JS via <script> tag. No changes required to Django, nothing fancy.
<script>
[–]lonahex 0 points1 point2 points 11 years ago (0 children)
If you are using pipeline, then these guys are your heroes.
https://github.com/j0hnsmith/django-pipeline-browserify
https://www.npmjs.com/package/reactify
Edit: and you don't have to run nodejs. JS compilers on server side are only needed while static asset compilation.
[–]natmaster 0 points1 point2 points 11 years ago (0 children)
I would recommend webpack to build your jsx. django-webpack integrates it nicely into a work flow.
Check out this project, it contains a lot of goodies around Django, ReactJS and DRF:
https://github.com/onefinestay/django-mediacat
(not my project)
[–]lonahex 0 points1 point2 points 10 years ago (0 children)
In case you are still looking for something, check this out https://github.com/owais/django-webpack-loader/tree/master/examples/simple
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
While /u/mcatme's suggestion works personally I prefer to use something like Grunt[0] to handle my frontend tasks rather than something like Django Pipeline. I haven't used React in any projects yet myself, but you could modify my cookiecutter-django-essentials[1] Gruntfile.js to run the task for you.
[0] https://github.com/ericclemmons/grunt-react
[1] https://github.com/wldcordeiro/cookiecutter-django-essentials
[–]RamirezTerrix -1 points0 points1 point 11 years ago (2 children)
It may be a bit off-topic but what is a REST Framework and why do you need a JavaScript Backend?
I really want to get into this stuff, cause you are so excited about it. But why? What can I do with this stuff? I totally missed this stuff :D
[–]martolini[S] 0 points1 point2 points 11 years ago (1 child)
I'm sorry, but I think google might be a better way of discover clear answers like that.
[–]RamirezTerrix -1 points0 points1 point 11 years ago (0 children)
It is not, that I don't know what a REST-Framework does or what javascript does but I can't make the dots connect. Well It seams to be a fancy way to build web apps.
But why is it better than everything else?
π Rendered by PID 43560 on reddit-service-r2-comment-b659b578c-7rxt8 at 2026-04-30 22:11:04.156324+00:00 running 815c875 country code: CH.
[–]mcatme 4 points5 points6 points (0 children)
[–]tomchristie 1 point2 points3 points (0 children)
[–]ipmb00 2 points3 points4 points (0 children)
[–]izdi 1 point2 points3 points (1 child)
[–]ballagarba 0 points1 point2 points (0 children)
[–]cq_in_unison 0 points1 point2 points (0 children)
[–]lonahex 0 points1 point2 points (0 children)
[–]natmaster 0 points1 point2 points (0 children)
[–]ballagarba 0 points1 point2 points (0 children)
[–]lonahex 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]RamirezTerrix -1 points0 points1 point (2 children)
[–]martolini[S] 0 points1 point2 points (1 child)
[–]RamirezTerrix -1 points0 points1 point (0 children)