There are two ways of doing this, depending on your way of Python installation. This is going to cover the way of Pip Distribution users. Here are the steps to start:
- Verify in your CMD (PowerShell) if you have
pip
installed:
C:\Users\DELL>pip
You should get the list of commands you can use with pip
. If you didn't get the desired result, you should check if Pip is added to PATH
environment variables.
- Clone the project on your local machine:
git clone https://github.com/ATOUIYakoub/JSON-Comparator.git
- Create your local virtual environment:
python -m venv env
#if error try:
python -m pip install virtualenv
we are using python 3.11.5 version for this project, you can name the virtual environment as you please venv
is just an example.
- Activate your virtual environment:
.\env\Scripts\activate
- Install the Backend Dependencies:
cd json_comparator
pip install -r requirements.txt
- Test if your backend is running correctly:
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
7.Configure Environment Variables
-
Create a
.env
file in the root directory of your project.In the root directory of your project, create a file named
.env
. -
Add the necessary environment variables, such as
API_KEY
, and other configurations.Example content for
.env
file:API_KEY=your_api_key_here
To test the JSON comparison functionality in Postman using files, follow these steps:
-
Open Postman.
-
Create a new POST request.
-
Enter the request URL: http://127.0.0.1:8000/api/compare-json/
-
Set the request method to
POST
. -
Go to the
Body
tab. -
Select
form-data
. -
Add two file fields:
-
For the first file:
- Set the
Key
tojson1
. - Set the
Type
toFile
. - Choose your first JSON file as the value.
- Set the
-
For the second file:
- Set the
Key
tojson2
. - Set the
Type
toFile
. - Choose your second JSON file as the value.
- Set the
-
Click "Send" to make the request.
-
Observe the response.
The response should include the differences between the two JSON files, indicating which sections were added, removed, or modified.