Posts

Showing posts from March, 2023

Integrating React Front-End and Django/Python/PostgreSQL backend

Image
So far, we have created the API and confirmed its working on the django admin page. Now, we will look at how to create a react app to display data from the database via django. 1. Setup the react App Install react using the following command from the root directory: npm install create-react-app Create a react app, and call it frontend npx create-react-app frontend start the server cd frontend npm start The default react app will show up on the localhost://3000.  Change the public/index.html page to include the root element. We will use this in the src/index.js file in just a while. <! DOCTYPE html > < html lang = "en" >   < head >     < meta charset = "utf-8" />     < link rel = "icon" href = "%PUBLIC_URL%/favicon.ico" />     < meta name = "viewport" content = "width=device-width, initial-scale=1" />     < meta name = "theme-color" content = "#000000" /...