Simple web application that allows users to view the current temperature at a given location.
This application was developed in Python 3.6, using Django, PostgreSQL, Docker, docker-compose and nginx.
- Use the Google Geocoding API to get the latitude/longitude for a given user input, as well as the city and state name.
- Use the Dark Sky API to get the temperature for a given latitude/longitude.
- Assume the temperature doesn't vary within the same latitude/longitude, with three decimal cases precision, within an 1-hour window.
- Track service usage by IP (how many times this IP used the service).
- Export service usage by IP for each day through a custom management command. With JSON format.
Clone:
git clone https://github.com/philippeoz/temperature_by_location.git
We have two ways to run:
- With Docker:
- Install Docker
- Install docker-compose
cd temperature_by_locationto enter on project dir.- Add a
settings.envfile with some configurations:DEBUG,GOOGLE_API_KEY,DARK_SKY_API_KEY docker-compose up --buildordocker-compose --build -d(daemon)
- With virtualenv:
- Install Postgresql and create a database (we will call
database). - Install Pipenv:
pip install pipenv - Enter on project dir:
cd temperature_by_location pipenv installcd app- Inside of 'app' dir, create a
settings.inifile with some configs:There are more environment variables that can be configured in[settings] DEBUG=True DATABASE_URL=postgres://username:password@host/database GOOGLE_API_kEY=faskdjfhaskldfYOURKEYdsjfasfl DARK_SKY_API_kEY=faskdjfhaskldfYOURKEYdsjfasflsettings.ini, see in the settings module. - From here you can choose to enter on virtualenv with
pipenv shellor run the commands from outside withpipenv run python, the example will be outside of env, to do inside just remove thepipenv run. pipenv run python manage.py migratepipenv run python manage.py runserver
- Install Postgresql and create a database (we will call