0

I have a repository and I want to deploy two application from it. I have it set up as two different applications in Heroku.

Im using a Procfile to load the Flask application and it deploys properly however when the Node application deploys it also tries to use the Procfile instead of using the Node buildpack i have loaded.

Is there a way to fix this other than separating the repositories?

Thank you in advance.

SwimMaster
  • 351
  • 3
  • 17

1 Answers1

0

You can define multiple workers in your Procfile.
https://devcenter.heroku.com/articles/procfile#more-process-type-examples

web: python main.py
app: npm start

However bear in mind an app can only have one active web worker. The flask app will probably use a port. And your node application will likely as well. In my example the app worker cannot open a port! If that is the case you need to host your repo on 2 separate Heroku Apps (change app to web in that case)

In order to mix Python (Flask) and Node you will need to install multiple buildpacks. You can let Heroku automatically detect them with requirements.txt, runtime.txt and package.json but it is not reliable.

This is why you should define your used buildpacks in a app.json https://devcenter.heroku.com/articles/app-json-schema#buildpacks

{
  "buildpacks": [
    {
      "url": "https://github.com/heroku/heroku-buildpack-nodejs"
    },
    {
      "url": "https://github.com/heroku/heroku-buildpack-python"
    }
  ]
}
Tin Nguyen
  • 5,250
  • 1
  • 12
  • 32