Why is my Flask app being detected as node.js on Heroku

flask, heroku, node.js, python

Solution

The problem was introduced when I added a `package.json` to my root directory when I started using npm. It seems that the build detection script runs the nodejs detection first (here) which leads to this code: `if [ -f $1/package.json ]; then echo "Node.js" && exit 0` executing and Heroku thinks it's a nodejs app and exits before the python detection has a chance to run.

To solve this I had to manually tell Heroku that I wanted a python build using this command

`heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python`.

Problem

I recently made some changes to the structure of my Flask app hosted on heroku and now heroku has decided to detect it as a Node.js app intead of a Python app. My application uses both python (Flask) for the backend api and javascript for the front end. The changes I made included integrating npm and bower into my application to streamline the javascript development of the app.

Original source