Hello, I'm trying to figure out how to rebuild my React.js project (with 
Django backend) and relaunch the Django dev server if a React.js file 
changes.  The code below works, but it rebuilds React even if the only code 
changes are in Django.  Can anyone suggest how to solve this problem?

import subprocess
from django.utils.autoreload import autoreload_started
from django.dispatch import receiver
@receiver(autoreload_started)
def rebuild_react_app(sender, **kwargs):
    sender.watch_dir(os.path.join(BASE_DIR, 'reactapp', 'src'), '*')
    subprocess.run(r'yarn --cwd ./reactapp build', shell=True)

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13c40a08-6084-4609-8141-ddcf029c33a7n%40googlegroups.com.

Reply via email to