The best way to keep your content up-to-date is by running a Celery worker that will update and cache all the plugins.
It’s easy to get it up and running.
Install the django-celery library:
pip install django-celery
Add the following lines to settings.py:
import djcelery
djcelery.setup_loader()
Add ‘djcelery’ to INSTALLED_APPS.
syncdb or migrate if you’re using south:
python manage.py migrate djcelery
Configure your tasks in settings.py:
BROKER_URL = 'amqp://guest:guest@localhost:5672/' # if you're using RabbitMQ
CELERY_IMPORTS = ("goscale.tasks", )
If you want a task to update GoScale plugins to be sent immediately after plugin was saved in the Django admin add this in your settings:
GOSCALE_UPDATE_FROM_ADMIN = True
If you want to setup a schedule for updating, configure Celery Beat:
from celery.schedules import crontab
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler' # or whatever you prefer
CELERYBEAT_SCHEDULE = {
"update_goscale_plugins": {
"task": "goscale.tasks.update_goscale_plugins",
"schedule": crontab(minute='*/30'), # every 30 minutes
"args": ()
},
}
Run your worker and celery beat:
python manage.py celery worker -B
For more detailed information refer to Celery documentation.
Periodic task that goes through all goscale plugins and sends tasks to update them.
Updates posts for a single plugin.
Usually scheduled by update_goscale_plugins task or when saving a plugin from Django admin.