I recently updated Rockstor and since then my scheduled tasks don’t work anymore. Cron sends the following mail (for every task to be executed):
Traceback (most recent call last):
File “/opt/rockstor/.venv/bin/st-snapshot”, line 3, in
from scripts.scheduled_tasks.snapshot import main
File “/opt/rockstor/src/rockstor/scripts/scheduled_tasks/snapshot.py”, line 25, in
from django.utils.timezone import utc
ImportError: cannot import name ‘utc’ from ‘django.utils.timezone’ (/opt/rockstor/.venv/lib/python3.11/site-packages/django/utils/timezone.py)
Any ideas how to solve this? I have already tried to delete all tasks and make new ones, but I still get the same errors.
@sanderweel hello again. Can you tell us to which version you have updated and which OpenSUSE Leap version (or are you running on TW)?
There was an issue opened and closed with this PR that addresses the deprecated function you’re showing above:
testing ← phillxnet:3021-Update-Django-to-latest-5.2-LTS
opened 03:10PM - 22 Nov 25 UTC
Pyproject.toml modified; resulting in `poetry update`:
```
Package operations:… 0 installs, 6 updates, 0 removals
- Updating wsproto (1.2.0 -> 1.3.2)
- Updating asgiref (3.10.0 -> 3.11.0)
- Updating certifi (2025.10.5 -> 2025.11.12)
- Updating keyring (25.6.0 -> 25.7.0)
- Updating django (4.2.26 -> 5.2.8)
- Updating zope-interface (8.1 -> 8.1.1)
Writing lock file
```
Fixes #3021
Includes a fix for the now critical:
"RemovedInDjango50Warning: The django.utils.timezone.utc alias is deprecated. Please update your code to use datetime.timezone.utc instead." In smart_manager/data_collector.py
And a storageadmin/admin.py fix re:
""(admin.E109) The value of 'list_display[2]' must not be a many-to-many field or a reverse foreign key."
Assuming admin.E109 as an improved sensitivity to problematic admin site Class definitions in the 'System check framework' inherited with the Django update. For this the list_display= `admin_users` field was simply remarked out for now.
---
Prior counterpart: https://github.com/rockstor/rockstor-core/pull/2752 where many of the "RemovedInDjango50Warning" warnings were already fixed.
But this was done on the testing branch.
2 Likes
I am using the testing branch. Leap 15.6 and Rockstor 5.5.0.0.
@sanderweel , it seems that you identified a missed piece of the correction that was implented earlier (see above).
There is now a new issue created on github by @phillxnet that will address this, hopefully soon.
opened 02:59PM - 18 Apr 26 UTC
Thanks to forum user 'sanderweel' in the referenced post for highlighting this i… ssue in our current testing phase: rpm v5.5.0-0 on a Leap 15.6 host.
```
Traceback (most recent call last):
File “/opt/rockstor/.venv/bin/st-snapshot”, line 3, in
from scripts.scheduled_tasks.snapshot import main
File “/opt/rockstor/src/rockstor/scripts/scheduled_tasks/snapshot.py”, line 25, in
from django.utils.timezone import utc
ImportError: cannot import name ‘utc’ from ‘django.utils.timezone’ (/opt/rockstor/.venv/lib/python3.11/site-packages/django/utils/timezone.py)
```
This looks very much like an unattended requirement re utc import / usage changes related to our most recent Django update.
I.e. we missed one.
---
Forum reference: https://forum.rockstor.com/t/cron-timezone-error-after-updating-rockstor/10924
Sorry for the current inconvenience.
1 Like