Editing
Defining Django App Dependencies
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== requirements.txt == It's important to always work in a virtual Python environment when working on Django projects. This way the list of active Python packages that have been installed to support the project will be tracked by `pip`. It's possible at any time to list the currently installed Python packages with `pip freeze`. To deploy the project's dependencies on another installation, first save the environment in `requirements.txt`: <syntaxhighlight lang="sh"> $ pip freeze > requirements.txt </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> <p class="alert alert-warning">`psycopg2` will throw an error if PostgreSQL is not installed on the system first.</p> Lines can be commented out in `requirements.txt` with the pound (`#`) character. === Deploying local stand-alone packages === See [[Packaging Stand-Alone Django Apps]] Push the package's distribution to GitHub. Add a line to `requirements.txt` to pull the package distribution from GitHub: <syntaxhighlight lang="text"> -e git://github.com/account_name/package_repo.git#egg=package_name </syntaxhighlight> Replacing `account_name`, `package_repo`, and `package_name` in the URL with the appropriate values. <p class="alert alert-warning">When a package is installed this way, it's necessary to add a directive in `.ebextensions/` to install Git via `yum`. === Manually Python package dependencies === <syntaxhighlight lang="sh"> $ pip install -r requirements.txt </syntaxhighlight> === Installing Python packages with AWS Elastic Beanstalk === `eb create` and `eb deploy` automatically attempts to install all the packages found in `requirements.txt`.
Summary:
Please note that all contributions to Littledamien Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Littledamien Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information