bamabacho
bamabacho

Reputation: 321

Moving project from one computer to another

I have a project I built in python 2.7 on one PC. It uses djagno 1.4.5 and some other modules that are kept in site-packages. I tried to copy the contents of Lib\site-packages to the new PC Python install, but I get missing module errors when I try to run manage.py runserver. Do I have to install everything again on the new pc and just transfer the project files?

Upvotes: 3

Views: 4511

Answers (1)

alecxe
alecxe

Reputation: 473763

Usually, you keep a list of your project requirements in requirements.txt and keep the file at the root of your project. Example requirements.txt content:

Django==1.6.5
lxml==3.3

On the new computer, you clone the repository containing the project source code (or get it different way), then install the requirements via pip python package manager:

pip install -r requirements.txt

Also, having separate virtual environments for every project is basically must have.


In order to create the list of requirements from your current python environment (virtual or system-wide), run:

pip freeze > requirements.txt

Upvotes: 7

Related Questions