Defining Django App Dependencies: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 15: | Line 15: | ||
$ pip freeze > requirements.txt | $ pip freeze > requirements.txt | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<p class="alert alert-warning">Creating this file in Windows, even after changing the line endings to Unix-style line endings, caused an error when running `pip install` on the the production Linux server (in `codec.py`).</p> | |||
`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`. | `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`. | ||
<p class="alert alert-warning">Do not include `psycopg2`. [[Django App Prerequisites for AWS Elastic Beanstalk|PostgreSQL gets installed outside this process]]. | |||
== Installing dependences == | == Installing dependences == | ||
Revision as of 12:52, 8 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
Creating this file in Windows, even after changing the line endings to Unix-style line endings, caused an error when running pip install on the the production Linux server (in codec.py).
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.
Do not include psycopg2. PostgreSQL gets installed outside this process.
Installing dependences
$ pip install -r requirements.txt
Notes
See also
- install_requires vs Requirements files - Python Packaging User Guide
References
- ↑ setup.py vs requirements.txt Donald Stufft