HE-Arc / FreeGo2

Application développée pour l’association FreeGo afin de promouvoir leurs réfrigérateurs communautaires.
https://application-freego.ch/
1 stars 0 forks source link

cron jobs on container #52

Open Kevin-Laipe opened 3 years ago

Kevin-Laipe commented 3 years ago

I think the problem comes from settings.py

CRONJOBS = [
    ('0 0 * * *', 'freego.cron.updatedb')
]

Doing python manage.py crontab show gives active jobs 4352ef0f6fe98d93b9d2faed8b627705 -> ('*/1 * * * *', 'freego.cron.updatedb', '>> cronjobs.log')

But running cronjobs with python manage.py crontab run 4352ef0f6fe98d93b9d2faed8b627705 gives an error ModuleNotFoundError: No module named 'freego.cron'

I tried different module names. Knowing that my custom command updatedb is at /backend/management/command/updatedb.py, I tried backend.management.command.updatedb, sliding in a .cron. Also tried django.core.management.updatedb etc, but nothing seems to work

However, running python manage.py updatedb works so we can still update the db manually through ssh

Kevin-Laipe commented 3 years ago

The problem is probably due to cron not running in virtualenv