I am learning how to integrate react with Django.. I found the tutorial by Dennis Ivy useful.. (linked below).
So according to that video, where we create a Django project, and create a separate folder with npx create-react-app appname
, we need to npm run build
every time we make a change to the react.. Is there a better way to do it?
my settings.py:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'reactapp/build'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATIC_URL = '/static/'
STATICFILES_DIRS = [
BASE_DIR / 'reactapp/build/static'
]
https://www.youtube.com/watch?v=F9o4GSkSo40&list=PLw4CVL8B1qWH_FsGE53Do_dSN-UdgGiGD&index=21