I have a fairly classic Python/Django app deployed to Heroku.
There's a pip package I want to use, django-mjml that itself relies on a Node.js module named mjml.
My question is how to combine the two? Doing npm init
and npm install mjml
created a node_modules
directory in my root folder, and also the files: package.json
and package-lock.json
. I guess that's not really what I want?
Not sure how to proceed from here and any directions are appreciated!
I haven't used that library, but you probably need to use multiple buildpacks:
Set your main buildpack to heroku/python
:
heroku buildpacks:set heroku/python
Add the heroku/nodejs
buildpack:
heroku buildpacks:add --index 1 heroku/nodejs
Confirm that the Node.js buildpack will run first and the Python buildpack will run second with
heroku buildpacks
Make sure you've got
requirements.txt
file (if you're using pip
) or both Pipfile
and Pipfile.lock
(if you're using Pipenv) committed for your Python dependencies, andpackage.json
file and either package-lock.json
(if you're using npm
) or yarn.lock
(if you're usng Yarn) committed for the mjml
dependency.The package.json
and package-lock.json
you mention in your question should suffice for the Node.js dependencies, but they have to be committed, and you need to set the buildpacks before pushing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With