I\'m following this tutorial: http://devcenter.heroku.com/articles/django
At some point I\'m suposed to do:
pip freeze > requirements.txt
<
That is one thing that has bugged me too quite a bit. This happens when you create a virtualenv without the --no-site-packages flag.
There are a couple of things you can do:
--no-site-packages flag.pip install directly, instead, add the library to your requirements.txt first, and then install the requirements. This is slower but makes sure your requirements are updated.INSTALLED_APPS, and database adapters. Most other required libraries will get installed automatically because of dependencies. I know its silly, but this is what I usually end up doing.-- Edit --
I've since written a couple of scripts to help manage this. The first runs pip freeze and adds the found library to a provided requirements file, the other, runs pip install, and then adds it to the requirements file.
function pipa() {
# Adds package to requirements file.
# Usage: pipa
package_name=$1
requirements_file=$2
if [[ -z $requirements_file ]]
then
requirements_file='./requirements.txt'
fi
package_string=`pip freeze | grep -i $package_name`
current_requirements=`cat $requirements_file`
echo "$current_requirements\n$package_string" | LANG=C sort | uniq > $requirements_file
}
function pipia() {
# Installs package and adds to requirements file.
# Usage: pipia
package_name=$1
requirements_file=$2
if [[ -z $requirements_file ]]
then
requirements_file='./requirements.txt'
fi
pip install $package_name
pipa $package_name $requirements_file
}