6đź‘Ť
âś…
Your error is probably because you don’t have your PYTHONPATH set properly, especially to include the path to the “notification” module. You also need to set the DJANGO_SETTINGS_MODULE path, if it isn’t already set in your environment.
Here’s a shell script I use to wrap my own django based cron task:
#!/bin/sh
DJANGO_SETTINGS_MODULE=mysettings
export DJANGO_SETTINGS_MODULE
PYTHONPATH=/path/to/python_libs:/path/to/my_django_apps
export PYTHONPATH
/path/to/python /path/to/my_django_script
👤ars
0đź‘Ť
As ars alluded to, cron runs with an entirely different set of environment variables than you do. The easiest way to fix that is to use a script similar to what he posted.
👤Xiong Chiamiov
- [Django]-Django Haystack + Elasticsearch strange intermittent bug
- [Django]-Django model error maximum recursion depth exceeded
- [Django]-Django Tests: User.authenticate fails
- [Django]-How can I tell if a value is a string or a list in Django templates?
Source:stackexchange.com