Steps to run weather system that will determine the weather of the current location as well as the booking location.
The system is built using a Django framework with the Django Rest Framework for the API aspect.
API endpoint looks like this:
/weather?current_location=-33.927407,18.415747&booking_location=-32.927407,19.415747JSON returned in a format such as this:
{
"current_location": {
"date": "2019-12-12",
"type": "clear-day",
"description": "Clear throughout the day",
"temperature": 21.94,
"wind": {
"speed": 4.66,
"bearing": 147,
"gust": 11.25
},
"rain_prob": 0,
"latitude": -33.927407,
"longitude": 18.415747
},
"booking_location": {
"date": "2019-12-12",
"type": "cloudy",
"description": "Overcast",
"temperature": 19.67,
"wind": {
"speed": 4.66,
"bearing": 147,
"gust": 11.25
},
"rain_prob": 35,
"latitude": -32.927407,
"longitude": 19.415747
}
}Install Python 3.7
Once Python is installed install virtualenv using the below command:
pip install virtualenvCreate virtual enviroment using the following command:
virtualenv venv_weatherActivate the virtual enviroment.
On Windows use the following.
venv_weather\Scripts\activate.batInstall the required packages, using pip and the requirements file.
pip install -r requirements.txtRun the django migrate
python manage.py migrateCreate a super user to access the admin interface, follow the promtes.
python manage.py createsuperuserRun the Django built in testing using the following command:
python manage.py testRun the server
python manage.py runserverOpen Docker and navigate to the application via the Docker terminal. Once at the application run the following commands:
docker-compose up -d --buildOnce everything is done, run the next command:
docker-compose upOnce the web service is running you can use the system on the following URL: http://192.168.99.100:8000/
To stop Docker once is running press CNTRL + C. Once the web service has stopped. Run the following command:
docker-compose down