Вопрос

I am having trouble with the beautifulsoup module dependency for heroku.

I followed the steps for specifying dependence here

https://devcenter.heroku.com/articles/getting-started-with-python#specify-dependencies-with-pip

But I keep getting the error "ImportError: No module named bs4" when it reaches this line "from bs4 import BeautifulSoup "

But the requirements.txt file has the following

beautifulsoup4==4.3.2

Also i did start from fresh and try to make a new app, that didn't work. These errors on the heroku servers, running the app locally gives me no problem.

Это было полезно?

Решение

I was using the PhantomJS buildpack.

However, that mean heroku was no longer detecting the python buildpack and thus not importing beautifulsoup.

To fix the problem, I exected this command in terminal

heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

Then I created a text file called ".buildpack" , include the dot at the beginning. I then pasted these two urls in the text file

https://github.com/heroku/heroku-buildpack-python
https://github.com/stomita/heroku-buildpack-phantomjs

This tell it to use the python buildpack and the phantomJS buildpack.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top