Reputation: 2283
The large number of apps/packages which can be used in python/django is a great advantage of both. This also raises a question about handling these installed applications/library, especially when there are multiple environments in which the project has to be deployed.
Installing such third party libraries to the system does not seem ideal to me. Thus after some research, I found that there are two possible ways to go namely virtualenv or including the package within the project folder. But the problems are that creating a virtualenv for each project is kind of messy and on the other side, including large packages within the project directory increases the project size and also creates import problems.
I have found kind of a middle ground between the above two methods which is to install libraries which can be shared with multiple projects into a virtualenv and smaller project specific libraries within the project.
For example, for a django project, I would install django into a virtualenv and other libraries used in the project for example xlwrt, dojango etc are included within a "lib" folder within the project.
Is this the best way to go or are there better alternative methods??
Upvotes: 1
Views: 156
Reputation: 31951
The best way is to use separate virtualenv for each project. There is nothing messy with it (use virtualenvwrapper).
Sharing a library between project is always a potentional risk: what if you want to upgrade the library in one project and use older version in another?
Also pip freeze
will list actual list of aps for the project, not some list you should filter manually.
Upvotes: 5