Carlos Aguilar
Carlos Aguilar

Reputation: 51

Heroku: ImportError: No module named site

After some changes in my repo and deploy to heroku I am receiving the following error:

ImportError: No module named site

I not have idea what can cause the problem because I only change some Django templates in the last 2 commits.

Best Regards

Upvotes: 5

Views: 13614

Answers (3)

user20310552
user20310552

Reputation: 1

Add the following to your proc file

web: gunicorn site:app

Also check your gitignore and make sure site isnt included

Upvotes: -1

James Gentes
James Gentes

Reputation: 8086

Heroku has an article for this: https://help.heroku.com/BWJ7QYTF/why-am-i-seeing-importerror-no-module-named-site-when-deploying-a-python-app

Updates to the Python buildpack mean that the PYTHONPATH and PYTHONHOME config vars being set on the app may introduce this issue.

Firstly, check if these are present with

heroku config

To fix the issue, you can unset them like so:

heroku config:unset PYTHONHOME -a appname

heroku config:unset PYTHONPATH -a appname

Upvotes: 4

frogbandit
frogbandit

Reputation: 571

Take a look at your Procfile. It should show something like this:

web: gunicorn site:app

Make sure site is the name of your app.

Upvotes: 7

Related Questions