Reputation: 1454
I'd like to deploy a Python script on a server and have it executed by the cron task scheduler. My script is not a web service or anything of the sort: it reads stuff from a database, does some computations on it and writes the results back to the database.
What would be the best way to deploy such a script? I've been considering either to make a stand-alone deployment using bbfreeze or to install Python on the target machine and install the script inside a virtualenv. What are the pros and cons of each approach? are there any other approaches I should consider?
Upvotes: 4
Views: 147
Reputation: 55448
I think having the script.py + virtualenv on the server is more convenient:
In which case you just need a cron line like
@daily cd /path && . venv/bin/activate && script.py
^ the dot is like "source", to activate the virtualenv
Upvotes: 1