How to move a python project from a dev system to a production server

adbyits
adbyits used Ask the Experts™
on
Hi all i have a question i am hoping you can help with, i have been working on a python project on a dev windows system and now i want to move it to a production linux system what will be the best way to do tis so i dont have to do allthe pip commands again
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
There's not that many options.

If your project was developped nicely it should have a file containing all the pip requirements (often it is named requirements.txt)

Then on your target platform you should just create a virtualenv for this project (I would at elast recommend to have one virtualenv per project)  and then type
pip install -r requirements.txt

Open in new window


If you don't have a requirements.txt file you can do a brute force approach:
Type on your windows host
pip freeze > allpackages.txt

Open in new window


open the file and remove any line of which you're sure it is not needed for your project. (or just leave it unchanged)

Then copy the file to your server and type in your project's virtualenv
pip install -r allpackages.txt

Open in new window

Author

Commented:
Great thanks so you think i should be using virtualenvfor my python stuff :) i would like to know the best way to do things
I think virtualenvs helps, that dependencies of two services (if you have two services on the same machine) are not contradicting and that updating dependencies for one project won't break the dependencies of another one.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial