Skip to content
Advertisement

Heroku: Run a Rails application with a Python script on the same instance

I have a Python script in the /app/bin directory of my Rails app that contains a requirements.txt file that includes all of the dependencies it relies on.

How do I get it to run on the same Heroku instance that my Rails app currently runs on (my Rails app call the python script occasionally).

Here’s what I’ve tried so far:

  1. Put the requirements.txt file in the / dir. Didn’t install any python dependencies
  2. Tried running heroku run bash and then running pip install -r requirements.txt. Got the message pip command not found.
  3. Tried installing pip through the bash interface using sudo python get-pip.py after curling the script as suggested on the pip installation site. Didn’t work — not surprisingly, they don’t support sudo commands on the instance.

I know Heroku is supposed to support pip out of the box, but it doesn’t seem to do anything with the requirements.txt file once it’s detected a Ruby app.

Advertisement

Answer

You can use the Heroku Buildpack Multi to run both the python and the ruby application on the same instance using their respective buildpacks.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement