Setup the environments variables:
DJANGO_SETTINGS_MODULE=olympic_history_athletes.envs.dev;
KAGGLE_USERNAME={kaggle_username};
KAGGLE_KEY={kaggle_key}
obs: To generate Kaggle credentials: https://github.com/Kaggle/kaggle-api
After created your virtual environment with virtualenv, in the directory of the project enter the commands:
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
obs: The database still out of data
To run the routine to get the csv from Kaggle and populate the database, it necessary run the command:
python manage.py process_tasks
The tasks will be schedule to run everyday inserting 50 new objects.
To UPDATE some object use the PUT http method:
PUT https://olympic-history-athletes.herokuapp.com/api/{category}/{id}/
Example:
PUT https://olympic-history-athletes.herokuapp.com/api/sport/1
payload:
{"name": "car"}
DELETE https://olympic-history-athletes.herokuapp.com/api/{category}/{id}/
Example:
DELETE https://olympic-history-athletes.herokuapp.com/api/sport/1
To CREATE some object use the DELETE http method:POST https://olympic-history-athletes.herokuapp.com/api/{category}
Example:
POST https://olympic-history-athletes.herokuapp.com/api/sport
payload:
{"name": "test"}
Example:
https://olympic-history-athletes.herokuapp.com/api/sport/?name=Judo
To filter athlete make a request to endpoint /api/athletes_search?Not work searching by the parameter id, just for the name.
It's able to put multiple filter.
Example:
https://olympic-history-athletes.herokuapp.com/api/athletes_search?medal=Silver&season=Summer
- games
- team
- season
- city
- sport
- event
- medal