7
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
8
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.