Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用.py和.env文件修复此Heroku部署错误?_Python_Heroku_Deployment - Fatal编程技术网

Python 如何使用.py和.env文件修复此Heroku部署错误?

Python 如何使用.py和.env文件修复此Heroku部署错误?,python,heroku,deployment,Python,Heroku,Deployment,我尝试使用Heroku和Github部署我的文件。 我将一个.py和一个.env文件上传到Github,并将其与Heroku连接。之后,我部署分支手册。 我得到这个错误,我不知道如何修复它 -----> Building on the Heroku-20 stack -----> Using buildpacks: 1. heroku/python 2. https://github.com/niteoweb/heroku-buildpack-shell.

我尝试使用Heroku和Github部署我的文件。 我将一个.py和一个.env文件上传到Github,并将其与Heroku连接。之后,我部署分支手册。 我得到这个错误,我不知道如何修复它

-----> Building on the Heroku-20 stack
-----> Using buildpacks:
       1. heroku/python
       2. https://github.com/niteoweb/heroku-buildpack-shell.git
-----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
       More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
 !     Push failed```

您的Python构建包不兼容

报告说:

如果配置的buildpack无法处理您的应用程序(由其决定),您将收到一个错误

Python构建包可以在以下位置找到:

bin/detect
脚本显示:

BUILD_DIR=$1

# Exit early if app is clearly not Python.
if [ ! -f "$BUILD_DIR/requirements.txt" ] && [ ! -f "$BUILD_DIR/setup.py" ] && [ ! -f "$BUILD_DIR/Pipfile" ]; then
  exit 1
fi

echo Python

为了让
bin/detect
脚本通过,需要在git存储库的根目录下有
requirements.txt
setup.py
Pipfile
。这是不存在的。

嗨,你应该在StackOverflow上做一个练习,解释如何正确地提问。社区是来帮助你的,但是你肯定需要提供更多的细节来帮助我们回答你的问题:)你看过错误建议查看的页面了吗?我不太确定我应该在“requirements.txt”文件中写什么?你的Python项目可能依赖于外部库。将这些库放入
requirements.txt
。您还可以使用
python-m pip freeze>requirements.txt创建该文件,它也可以是
python3
py
py3
。谢谢。它是有效的…请将问题设置为已解决。非常感谢。
BUILD_DIR=$1

# Exit early if app is clearly not Python.
if [ ! -f "$BUILD_DIR/requirements.txt" ] && [ ! -f "$BUILD_DIR/setup.py" ] && [ ! -f "$BUILD_DIR/Pipfile" ]; then
  exit 1
fi

echo Python