This is a sample project that combines Django and React to create a web application that allows users to add names to a database and display them in a list. The application uses Django for the backend and React for the frontend, along with Bootstrap for styling.
- Python 3.x
- Node.js
- npm (or yarn)
- Django
- Django REST Framework
- Axios
- Bootstrap
-
Clone the repository and navigate to the backend folder:
git clone <REPOSITORY_URL> cd <REPOSITORY_NAME>/backend
-
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Run the database migrations:
python manage.py migrate
-
Start the Django development server:
python manage.py runserver
-
Navigate to the frontend folder:
cd ../frontend
-
Install the dependencies:
npm install
-
Start the React application:
npm start
- Open your web browser and go to
http://localhost:3000
to see the React application. - Enter a name in the input field and click "Submit" to add it to the list.
- The names will be displayed in the list below the form.
Django-React-NamesApp
├── backend
│ ├── backend
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── api
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── models.py
│ │ ├── serializers.py
│ │ ├── tests.py
│ │ └── views.py
│ ├── manage.py
│ └── requirements.txt
├── frontend
│ ├── public
│ ├── src
│ │ ├── App.js
│ │ ├── index.js
│ │ └── ...
│ ├── package.json
│ └── ...
├── .gitignore
├── requirements.txt
└── README.md