0

I have written a python script on my local laptop which uses several third party packages. I now want to run my script regularly (via a cron job) on an external server.

The external server most likely does not have all the dependencies installed, is there is a way to package and deploy my python script and dependencies in order to ensure that it will run?

I have already tried to package the script as an exe, but failed to do so.

2 Answers 2

2

Not clear what kind of third party packages you have, but for those that were installed with pip, you can do this in your dev environment:

$ pip freeze > requirements.txt

And then you can install these packages in your production environment:

$ pip install requirements.txt

Ideally, you will already have a virtualenv on your production box. If not, it may be well worth reading about these before deploying your script.

Sign up to request clarification or add additional context in comments.

3 Comments

what is a virtualenv? i know, i can google, but i think you could recommend any good introductory reads about virtualenv. thanks!
by the way, how i did it now: i just copied the script on my external server, and downloaded all the requirements/dependencies i needed. then created a cronjob and that's it. if i will deploy more python projects on this external server, i will surely check out virtualenv!
-1

Just turn your computer into a server. Simply set up your router for port forwarding so that your server's content's will display when the router's IP is entered. You can of course purchase a DNS domain to give that IP a human readable URL.

2 Comments

that's not really feasible for me. i don't want my laptop to run 24/7. i have access to real servers and want to make use of them. however, they run on different OS, etc... so i am thinking of an efficient way to deploy the python script, which i developed on my laptop on these external servers.. there must be a way, i'm sure.
Perhps you can use SSH to connect to these servers and install Python and the other frameworks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.