This is a django API application that allows a user to get the minimum, maximum, average and median temperature for a given city over a period of time.
Create a Django application with RESTful API
- Django application must run locally
- API must be in the format /api/locations/{city}/?days={number_of_days}
- API must fetch weather data from some public API of your choice
- API must compute min, max, average, and median temperature
- Response format must be in the following structure:
{
"maximum": "value",
"minimum": "value",
"average": "value",
"median": "value"
}Project can be deployed in two ways.
- Docker Container
- Django Server(Development & test)
For quick setup, use docker.
- Docker
- Docker-compose
Ensure below ports are not occupied by any running service.
- 80,443 -
Nginx Webserver
bash setup_docker.shhttps://<host>/admin
username:admin
password:admin- Python3.6+
Run develop server.
# Install required python libraries
pip install -r requirements.txt
# Copy env.example to .env
cp env.example .env
# Migrate migrations
./manage.py migrate
# Run server
./manage.py runserver
To run unit test.
$ ./manage.py test