Defining Django App Dependencies: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "Category:Django Category:Web Development There are two files that control app dependencies: `setup.py` and `requirements.txt`. == Notes == === See also === * [http...")
 
No edit summary
Line 1: Line 1:
[[Category:Django]] [[Category:Web Development]]
[[Category:Django]] [[Category:Web Development]]
== Overview ==


There are two files that control app dependencies: `setup.py` and `requirements.txt`.
There are two files that control app dependencies: `setup.py` and `requirements.txt`.
`setup.py` is a list of "abstract" dependencies without a specification as to their source.
`requirements.txt` is more specific about source and version number.<ref>[https://caremad.io/2013/07/setup-vs-requirement/ setup.py vs requirements.txt] Donald Stufft</ref>
== Packaging dependencies ==
In the project's root directory:
<syntaxhighlight lang="bash">
$ pip freeze > requirements.txt
</syntaxhighlight>
`pip freeze` will list everything installed via `pip` in an environment. Some of these thing will not be requirements of the web app, and should be removed from `requirements.txt`.
== Installing dependences ==
<syntaxhighlight lang="bash">
$ pip install -r requirements.txt
</syntaxhighlight>


== Notes ==
== Notes ==
Line 8: Line 29:


* [http://python-packaging-user-guide.readthedocs.org/en/latest/requirements/ install_requires vs Requirements files] - Python Packaging User Guide
* [http://python-packaging-user-guide.readthedocs.org/en/latest/requirements/ install_requires vs Requirements files] - Python Packaging User Guide
* [https://caremad.io/2013/07/setup-vs-requirement/ setup.py vs requirements.txt] Donald Stufft


=== References ===
=== References ===
<references />
<references />

Revision as of 18:15, 7 February 2016

Overview

There are two files that control app dependencies: setup.py and requirements.txt.

setup.py is a list of "abstract" dependencies without a specification as to their source.

requirements.txt is more specific about source and version number.[1]

Packaging dependencies

In the project's root directory:

$ pip freeze > requirements.txt

pip freeze will list everything installed via pip in an environment. Some of these thing will not be requirements of the web app, and should be removed from requirements.txt.

Installing dependences

$ pip install -r requirements.txt

Notes

See also

References