Concerned-Coyotes / summer-code-jam-2020

The repository for the 2020 summer code jam. Find more information at https://pythondiscord.com/pages/code-jams/code-jam-7/
MIT License
0 stars 0 forks source link

background task to get all data from apis #22

Closed HealYouDown closed 4 years ago

HealYouDown commented 4 years ago

We need a background task that runs every day (?) and queries the related information for all users from the apis.

I did some googling and found Django Background Tasks, maybe we could use that. Not sure if it is still compatible as the docs say up to 2.2.

Things like weather would also have to be queried and updated whenever a new user registers an account, so that we have data to display.

MushroomMaula commented 4 years ago

I am currently using django-background-tasks to create a task which fetches the news. However you need to run the tasks using the managment script. I (think) i fixed this by creating a thread on startup which uses django.core.management.call_command to run the tasks. Weather could be queried once a day for a fixed set of locations, i.e. the world meteorological organization publishes wheater forecast for various location around the world once a day.

MushroomMaula commented 4 years ago

It seems like my workaround is not working as it results in an error. Therefore we either have to run it from command line or setup something like celery or another task queue. However I have no experience with these