diff --git a/README.md b/README.md index 9644562..240d317 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,6 @@ The chirps application makes use of Celery and RabbitMQ for job processing. Exec Both the rabbitmq and celery commands have `--stop` and `--restart` options as well. -#### IMPORTANT CELERY TIP - -If you make changes to a Celery task, it must be restarted in order for those changes to be picked up. Simply run -`./manage.py celery --restart` - ### Run Webserver `./manage.py runserver` diff --git a/chirps/base_app/management/commands/celery.py b/chirps/base_app/management/commands/celery.py index fb6e282..9f3de31 100644 --- a/chirps/base_app/management/commands/celery.py +++ b/chirps/base_app/management/commands/celery.py @@ -2,6 +2,7 @@ import os from django.core.management.base import BaseCommand +from django.utils import autoreload class Command(BaseCommand): @@ -18,12 +19,13 @@ def add_arguments(self, parser): def handle(self, *args, **options): """Handle the command.""" if options['start']: - self.start() + self.stop() + autoreload.run_with_reloader(self.start) elif options['stop']: self.stop() elif options['restart']: self.stop() - self.start() + autoreload.run_with_reloader(self.start) def start(self): """Start the celery server."""