我正在将 Django App
部署到 Heroku。一切正常,但是当我使用 heroku master
将代码推送到 git push heroku master
时,它安装了所有要求,但最后显示了
remote: cwd: /tmp/pip-install-eh43np6w/importlib/
remote: Complete output (11 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/__init__.py", line 5, in <module>
remote: import distutils.core
remote: File "/app/.heroku/python/lib/python3.9/distutils/core.py", line 16, in <module>
remote: from distutils.dist import Distribution
remote: File "/app/.heroku/python/lib/python3.9/distutils/dist.py", line 19, in <module>
remote: from distutils.util import check_environ, strtobool, rfc822_escape
remote: File "/app/.heroku/python/lib/python3.9/distutils/util.py", line 9, in <module>
remote: import importlib.util
remote: ModuleNotFoundError: No module named 'importlib.util'
然后
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to nytictactoe.
remote:
To https://git.heroku.com/nytictactoe.git
还有
No Python version was specified. Using the buildpack default: python-3.9.5
我已经尝试了很多次,但它一直显示此错误。
任何帮助将不胜感激。
提前致谢。
答案 0 :(得分:0)
确保包含这些文件
runtime.txt
Procfile
requirements.txt
-runtime.txt 包含您的 python 版本
-requirements.txt 包含您正在使用的软件包
-Procfile 包含一些我不知道的东西,所以我建议在 Heroku 文档中查看