Hi folks, today I’m going to write about how to use python 3 and django on heroku.
First of all, we’ll install virtualenv to control the python’s version that we’ll use:
Particularly I prefer to use the virtualenvwrapper, then let’s install the virtualenvwrapper. If you don’t know this wrapper see the documentation: http://virtualenvwrapper.readthedocs.org/en/latest/
To install the virtualenvwrapper is easy:
Now we need to make a directory for our environments and to set it up as a global variable:
After the virtualenv and virtualenvwrapper are installed, we need to download the python and to install it:
Now we can start an environment with python 3 and to install django and gunicorn:
With django installed let’s start an project
Inside the project directory, we need to create a file called runtime.txt containing the version of the python that we’ll use. This file will specify the version of python.
Make a requirements.txt file to specify the dependencies.
Make a Procfile to explicit what command should be executed to start the dyno.
We need to put our application on git
Considering that you have heroku installed and you’re logged, we need to make a heroku repository
let’s deploy our application
See the application running on heroku with python 3 and django 1.5