I've written few management commands to run from cron. I'm using pipenv
virtual environment
running from terminal directly is working great.
cd <project_path> pipenv run python manage.py <my_command>
I added same script as cron
cd /home/project_path && pipenv run python manage.py <my_command>
But this is giving error as
/bin/bash: pipenv: command not found
I also tried following command
cd /home/project_path && python manage.py <my_command>
which is giving error as
File "manage.py", line 14
) from exc
^
SyntaxError: invalid syntax
what solved my issue is setting absolute path to every module like
cd <project_path> && /root/.local/bin/pipenv run /home/user/.local/share/virtualenvs/myproject-IuTkL8w_/bin/python manage.py <my_command>