importorror:没有名为si的模块

2024-05-11 14:19:57 发布

您现在位置:Python中文网/ 问答频道 /正文

在对我的repo进行一些更改并部署到heroku之后,我收到以下错误:

importorror:没有名为site的模块

我不知道是什么导致了这个问题,因为我只在最后两次提交中更改了一些Django模板。

致意


Tags: 模块django模板heroku部署错误siterepo
3条回答

Heroku对此有一篇文章:https://help.heroku.com/BWJ7QYTF/why-am-i-seeing-importerror-no-module-named-site-when-deploying-a-python-app

Python构建包的更新意味着应用程序上设置的PYTHONPATH和PYTHONHOME配置变量可能会引入此问题。

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

我有一个很相似的问题,我能解决。也许是同样的问题?

Heroku app crashed after pushing small change. Very confused

看看你的程序文件。它应该显示如下内容:

web: gunicorn site:app

确保site是应用程序的名称。

相关问题 更多 >