Reputation: 127
I am new to programming/web development and I want to push a Django directory to heroku. But every time I enter "git push heroku master" into my command line I get the same error:
"Could not find a version that satisfies the requirement bonjour-py==0.3 (from -r /tmp/build_602f#############86ff270e/requirements.txt (line 3)) (from versions: )"
I activated the virtual environment, but to no avail. Now I assume that the problem might be that my requirements.txt file does not contain anything (as I thought there would not be a reason for that, anyway). Still, I wonder what "bonjour-py==0.3"
is and how that could be fixed. Thank you very much for your help!
Upvotes: 5
Views: 16202
Reputation: 205
The problem is, that python2.7 and python3.x are different versions. You need the same version of python - server and local.
ToDos:
Take the terminal an go to the project directory
cd /your/path/to/project/
Activate your virtualenv
source env/bin/activate
Generate requirements.txt with pip
pip freeze > requirements.txt
Go to your server and create new virtualenv with same python version (https://virtualenv.pypa.io/en/stable/reference/#cmdoption-p)
virtualenv --python=python2.7 env
Activate virtualenv on server
source env/bin/activate
Install requirements.txt with pip
pip install -r requirements.txt
Django migrations
python manage.py migrate
Start django with runserver (to test) or connect webserver (nginx, uwsgi, gunicorn, ...)
python manage.py runserver
Upvotes: 7
Reputation: 1067
Inside your Python virtual environment and in your project path, just type:
pip freeze > requirements.txt
.
This will list inside the requirements.txt
file the exact version of each python package you use. And that's how Heroku will know what packages it needs to install in order to run your Django app.
Upvotes: 12