Django-react project integration

In this tutorial we will learn connect react app into django by few steps

Step 1: Suppose you have project folder directory like as :

Ecom_project
-> back-end
->front-end
Firstly go to front-end directory run command : npm run build
Then move front-end directory into back-end

Step 2: go to settings.py file and edit this like below:

Import os
‘DIRS’ :[os.path.join(BASE_DIR,’ecom_project/build’)]

STATICFIELS_DIRS = [ os.path.join(BASE_DIR, ‘ecom_project/build/static’)]

Step 3:
Go to urls.py file and add this

from django.views.generic import TemplateView
path(‘ ‘, TemplateView.as_view(template_name=’index.html’)),

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arjun Baidya

Software developer | React , Python,Django,Go, Node , django-rest-api