priMo-ex3m
priMo-ex3m

Reputation: 1092

Dependency installation for Python (Django) project

I'm new to Python, but I had a requirement at my work-place. Another programmer is developing a project on Python using Django framework, and my task is to find a way in which this project will be executed on any computer. So, I'm talking about something like Composer for PHP. I need an easiest way that at debian branch to write in terminal a command, that will find some kind of "composer.json" file on the project, will read all the required software, modules, libraries and install it step-by-step on the PC.

Any ideas how to do it in the easiest way? Thanks.

Upvotes: 7

Views: 20399

Answers (3)

aaronbassett
aaronbassett

Reputation: 328

Using pip freeze > requirements.txt is an anti-pattern. It does some things right, such as pinning version numbers, but it can lead to problems with orphan packages later.

I use pip-tools, this way only your top level dependencies are placed in your requirements.in file and then I use pip-sync to sync my local environment with pip.

There's a lot more information on pip best practices in my 2016 Pycon UK talk - Avoiding the "left pad" problem: How to secure your pip install process

Upvotes: 4

aman kumar
aman kumar

Reputation: 3156

in python there is requirements.text file which take care of the libraries that is used in that project. You should also use the virtualenv

Upvotes: -3

Aniket Pawar
Aniket Pawar

Reputation: 2721

Since you have not talked about virtual environment, assumed that you already setup the environment and activated it.First get all the libraries lists in requirement.txt file in your project directory by typing below command,

pip freeze > requirements.txt

when you need to setup project in another system just run this

pip install -r requirements.txt

All the dependency will be installed in your project enviornment.

Upvotes: 20

Related Questions