This a Django application with User and ActivityPeriod models. Created a custom management command to populate the database with some random data. All the data can be viewed with a REST API in json format.
Start by cloning the reposirtory.
git clone https://github.com/hritik7080/fullthrottle-test.git
Change your working directory.
cd fullthrottle-test
Then intsall all the required libraries with following command.
pip install -r requirements.txt
Now you have all the dependencies intalled in you system for this projet.
By default the database may be empty. So you can add some dummy data with a custom management command.
python manage.py populate_database 10
This will add 10 values in the Users model. For each user program will create 3 values in ActivityPeriod for start_time and end_time. That means, when you create 10 values for Users model the program will create 30 values for ActivityPeriod model. Start time and end time may not be meaningful as they were generated randomly.
To append the new data in the database. Use this command:
python manage.py populate_database 10 --append
This will not delete the previously added data.
To run the application on localhost type following command.
python manage.py runserver
The app is now hosted on your machine.
To get all the data stored in the Database in the json, use following API with get request.
http://127.0.0.1:8000/data/getdata/
You can open this link directly on browser or use postman o check the api.
https://fullthrottl-test.herokuapp.com/data/getdata/
Just open this link on browser or postman to check my hosted django appliation.
On postman use get request only.