r/django • • May 25 '20

Combining Django & React (open-source) https://knboard.com/

337 Upvotes

37 comments sorted by

39

u/AsSimple May 25 '20

Github: https://github.com/rrebase/knboard

Here's an actual real-world example of a recommended approach when combining Django & React.

Django REST framework is used to serve the API for the React app, which is bundled into static files, served by Nginx. See the docker files & nginx.conf for the actual configuration.

2

u/nishant_wrp May 25 '20

But that disturbs the hot reload feature, right?

4

u/AsSimple May 26 '20

In development Nginx is not used. Webpack-dev-server and Django dev server run separately and hot/auto-reload perfectly.

Also since the frontend hasn't ejected from the react-scripts, we'll get the upcoming react-hot-loader change for Fast Refresh as well :)

1

u/nishant_wrp May 26 '20

Got it! Thanks!

4

u/[deleted] May 25 '20

Looks awesome! Thanks for sharing

2

u/imAvi92 May 26 '20

This is amazing. I'm a frontend developer and started learning django. Currently I'm using heroku for backend and netlify for frontend. Could you pls help me where should I start nginx

2

u/lamby May 25 '20

Stargate?

1

u/[deleted] Nov 19 '20

What’s stargate

1

u/lamby Nov 20 '20

Stargate SG-1.

12

u/AlenEviLL May 25 '20

This is amazing and just what I have been looking for. I started learning JS and React and was looking for examples on how to implement it with Django. Thank you very much!

6

u/Sjnao May 25 '20

I m trying something similar, and now I see yours I feel really demotivated, it looks so clean like mine will never been. How much time did you invested onto this if I might ask.?

11

u/334578theo May 26 '20

if you're struggling to with the UI then use a UI library, it will make your life so much easier - personal favourite at the moment is UIKit

https://getuikit.com/

1

u/nityananda Jun 01 '20

I was searching for some good example of React with Django and your is amazing.

Are you planning to use also social login/signup through Django Allauth? That would make it even better.

1

u/AsSimple Jun 01 '20

Hey, django-allauth is actually already used in the background so adding social login/signup should actually be quite easy. It sounds like a great improvement, but which ones should be used? Github, Google, FB?

Feel free to create an issue/open a pull request if you want to contribute.

1

u/nityananda Jun 01 '20

Github, Google and FB sounds good.

I would love to contribute this, but I am completely new into React so I don't know how yet.

1

u/MedAziz11 Sep 06 '20

Can i know what u used to create that dialogue task with the text editor amd all the other features of it?

2

u/AsSimple Sep 06 '20

Hey, I used `react-markdown-editor-lite`. There are many different options to choose from like `Draft-js`, `react-mde`. Just need to try them out and see which one fits your needs.

Implementation here: https://github.com/rrebase/knboard/blob/master/frontend/src/features/task/EditTaskDialog.tsx#L393

1

u/MedAziz11 Sep 06 '20

Thnx and amazing work btw

3

u/OMDB-PiLoT May 25 '20

This is brilliant, something I've been looking for! Great work.

3

u/mattsb May 25 '20

I made a script to build this type of setup, including JWT login. Check it out!

https://github.com/mattburlage/create-django-react-app

1

u/slenderman878 May 27 '20

Thanks for the easy to use setup! I was wondering if you could elaborate a little bit on what you mean with "Map a static path /app/ to the build folder. /app/build/".

2

u/FreshPrinceOfRivia May 26 '20

Awesome, one of the finest projects I've seen on this sub

2

u/Teilchen May 28 '20

Awesome! Trello execs hate this trick.

Ever tried Vue – any thoughts on coupling it with Django? Heard it's a lot less complex

3

u/NotSelfAware May 25 '20

What are you using for authentication of the API?

3

u/brtt3000 May 25 '20

Looks like dj-rest-auth with django-allauth for registration.

1

u/lyapustin May 25 '20

Looks really nice!

1

u/FelipeLincoln May 25 '20

really impressive!! πŸš€πŸš€

1

u/wishicouldcode May 26 '20

Thank you, this looks great. I have cloned and started poking around, looking forward to the blog series.

1

u/ceandreas1 May 26 '20

Do you use services for this or put it all together in one server?

1

u/[deleted] May 26 '20

Great thanks for sharing

1

u/Jefe_3mman May 26 '20

This is awesome dude! I definitely needed this!

1

u/sandipdulal May 26 '20

Any video tutorial ?

0

u/throwitofftheboat May 25 '20

Can someone point me in the direction of these Django GUI Apps? Can you edit models and views with them?

0

u/[deleted] May 25 '20

[deleted]

1

u/[deleted] Nov 19 '20

Can you explain why, for educational purposes