Update of Python Runtime in Meilix
Meilix Generator is a webapp uses flask with Python, Werkzeug, and Jinja 2. It triggers Travis to release in an ISO. It is deployed on Heroku. An older python version caused the webapp to load very slowly and it also become unsupported so there was a need to update the python version. In this blog post we walk through the update of Python in the project.
We can specify an explicit version of Python to be used to run your application. For example, if you require Python 2, add the following to your Pipfile:
[requires] Python_version = "2.7"
Then run $ pipnv lock to generate Pipfile.lock and push to Heroku.
If we are using pip, we can supply a runtime.txt file.
$ cat runtime.txt python-3.6.1
Building of the webapp (Example)
The webapp build in Heroku and provide us a log. The log presents the packages installed and its version. Log also shows if any newer version is present for the package.
While building webapp, we get this as a log:
-----> Python app detected ! The latest version of Python 3 is python-3.6.5 (you are using python-3.6.1, which is unsupported). ! We recommend upgrading by specifying the latest version (python-3.6.5).
This confirms that we need to update python version and so thus we edited the runtime.txt
Now building the same webapp, we get:
Python app detected -----> Found python-3.6.1, removing -----> Installing python-3.6.5 -----> Installing pip
It already using older python, so it need first to remove the older version and then it install the latest one.
The same implementation can be seen in the history.