Issue
I'm trying to deploying an app with Heroku via PHP, but it runs a Python script that is dependent on Python libraries to run (e.g. numpy).
How would I go about including this dependency in a composer.json file?
Solution
Use multiple buildpacks.
Configure your application to use the official PHP buildpack:
heroku buildpacks:set heroku/phpAdd the official Python buildpack:
heroku buildpacks:add --index 1 heroku/pythonRunning
heroku buildpacksshould show the Python buildpack first and the PHP one second.The last buildpack in the list will be used to determine the process types for the application. Any process types defined from earlier buildpacks will be ignored.
Make sure you have a
composer.jsonthat defines your PHP dependencies in the root of your repository for your PHP buildpack.Make sure you have either a
requirements.txtfile (if you want to usepip) or aPipfileandPipfile.lock(if you want to use Pipenv) that defines your Python dependencies in the root of your repository for your Python buildpack.It's also a good idea to specify the supported Python version that you wish to use. If you are using Pipenv, this information can be included in your
Pipfile. If you are usingpipyou can use aruntime.txtfile in the root of your repository.
The next time you deploy you should see your Python dependencies get installed first, followed by your PHP dependencies.
Answered By - Chris
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.