Skip to content

SuryaPratap2542/Django-React

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Django-React Integration Project

This project demonstrates the integration of Django as a backend and React as a frontend to create a simple web application. The application allows users to input their name and email, which is then displayed both in the Django Rest Framework and on the React frontend.

image

Description: This screenshot shows the Django backend where user data input .

image

Description: This screenshot shows the Django API app named api located inside the djangobackend folder.

image

Description: This screenshot displays the React frontend where user data is displayed.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js and npm installed on your system.
  • Python and Django installed on your system.

Installation and Setup

  1. Clone this repository to your local machine:

    git clone https://github.com/your-username/django-react-integration.git
  2. Change into the project directory:

    cd django-react-integration
  3. Set up the Django backend:

    • Create a virtual environment:

      python -m venv venv
    • Activate the virtual environment:

      • On Windows:

        venv\Scripts\activate
      • On macOS and Linux:

        source venv/bin/activate
    • Install Django and other dependencies:

      pip install -r requirements.txt
    • Apply migrations and run the Django server:

      python manage.py migrate
      python manage.py runserver

    The Django API should now be accessible at http://localhost:8000/api/student/.

  4. Set up the React frontend:

    • Change into the frontend directory:

      cd frontend
    • Install frontend dependencies:

      npm install
    • Start the React development server:

      npm start

    The React frontend should now be accessible at http://localhost:3000/.

Usage

  1. Access the React frontend at http://localhost:3000/.

  2. Enter your name and email in the form on the homepage and click "Submit."

  3. The data you entered will be displayed on the same page.

  4. To view the data in the Django Rest Framework, visit http://localhost:8000/api/student/ in your browser or use an API client like Postman.

License

This project is licensed under the MIT License - see the LICENSE file for details.