Home > Software engineering >  Django and React - npm run watch/build very slow
Django and React - npm run watch/build very slow

Time:02-27

I'm trying to make a django/drf and react project but it takes 15 seconds for npm run build to finish. What are my options here? It's not feasible to wait that long after every change I make to the front end. Should I keep the react and django parts separate till the end?

I followed these instructions since I'm new to npm:

https://medium.com/how-to-react/use-npm-watch-to-auto-build-your-reactjs-app-6ed0e5d6cb00

CodePudding user response:

If you need a development setup with React & Django, you can :

  • do npm run start to open your create-react-app project in development
  • add "proxy": "localhost:8000" in your package.json so that AJAX requests from React are forwarded to Django
  • make sure Django is running on port 8000 with ./manage.py runserver

The npm run build is only needed to deploy usually.

  • Related