Environment Variables when python script run by cron

后端 未结 5 2078
渐次进展
渐次进展 2020-12-16 09:56

I have been looking at other stack overflow questions but couldn\'t get any to work. I have a python script which uses environment variables. This script works exactly as pl

5条回答
  •  无人及你
    2020-12-16 10:47

    You can set the env variable inline:

    * * * * * root ENV_VAR=VALUE /usr/bin/python3.5 /code/scraper.py

    Another way is use honcho that you can pass a file with env variables.

    honcho -e /path/to/.env run /code/scraper.py

提交回复
热议问题