dmytrobe/weather-api

Simple rest API for tracking weather forecasts

★ 0Forks 0PythonGitHub ↗Compare

README

Quickstart

It's project generated using my cookiecutter.
First create and activate your virtualenv with python3 interpreter, you can use virtualenvwrapper cd to your project and install the dependencies

pip install -r requirements/development.txt

Project use OpenWeatherMap api, so you should configure your api key.

You should configure project using environment variables. I prefer to do it using .env file There are plugins or utilities which fill your environment from .env file:

Or you can just export environment vars which you need

export OWM_KEY=your_open_weather_map_key

The example configuration is in env.example file

To start project, run migrations and command which save OWM locations to database

python manage.py migrate
python manage.py save_locations_to_database

Once everything it's setup you can run the development server: http://localhost:8000/

python manage.py runserver

How to use it

Settings

Settings are divided by environments: production.py, development.py, test.py. By default it uses development.py, if you want to change the environment set a environment variable:

export DJANGO_SETTINGS_MODULE="config.settings.production"

or you can use the settings param with runserver:

python manage.py runserver --settings=config.settings.production

Contributors

dmytrobe

Issues