I used RabbitMQ as the broker, and connected to the default at
amqp://guest:**@127.0.0.1:5672//.
so I didn't need to specify a username or password for rabbit. I used Windows 10, so I did need to install Erlang as admin and then install RabbitMQ via the Bintray link.
https://www.erlang.org/downloads
https://www.rabbitmq.com/install-windows.html
Celery > 4.1 does not work with Windows 10 properly, so I used eventlet.
In a Mac terminal or Windows Powershell, cd into the directory where you want to put the project and use:git clone https://github.com/DavTho1983/WeatherAPI.git
Now immediately cd into Weather
cd Weather
To use the admin section you will need to create a superuser with:
python manage.py createsuperuser
In a separate terminal, cd into Weather and, run the celery worker with:
celery -A Weather worker -l info -P eventlet
This project uses django-celery-beat to schedule periodic tasks. In a separate terminal, cd into Weather and start the celerybeat scheduler with:
celery -A Weather beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
python manage.py runserver
Open up your browser and navigate to
localhost:8000/api
The scheduler should update the LondonWeather model immediately and once at the start of every hour.
Uncommenting line 23 in Weather/celery.py will schedule a task for every 10 secs so you can see more data.