I have a Python app on Heroku running with Django. The app launches and works perfectly. The first couple lines of a push look like this:
(venv)➜ djangoproject git:(development) ✗ git push
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 1.96 KiB, done.
Total 21 (delta 15), reused 0 (delta 0)
-----> Heroku receiving push
-----> Python/Django app detected
...
I need to install a gem program on the dyno (specifically, Compass).
Heroku’s instructions are to provide a Gemfile and Gemfile.lock in the root directory with the required gems. As soon as I provide this, however, Heroku thinks the app is a Ruby app:
(venv)➜ djangoproject git:(development) ✗ git push
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 1.96 KiB, done.
Total 21 (delta 15), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby app detected (NOTE: this is paraphrased)
...
Is there any way I can install a ruby gem while running the site as a Python/Django app?
Try explicitly selecting the python buildpack by using
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python.gitIt will still perform the detection process but I think (?) it will run the buildpack you’ve explicitly selected before or instead of attempting any others, and since you still have a python application installed, it should work.
Note that after you do the config:add you need to rebuild your slug on Heroku, which currently can ONLY be done by pushing an actual code change via git. You can make an empty git commit if you don’t have any real changes to push, using
git commit --allow-empty -m "Empty commit"You can also create a new project using the –buildpack command line option.