[英]Failed pushing Python Flask App to Heroku
New to Flask and deploying on Heroku, trying to push to Heroku and I get this error when installing dependencies: Flask 的新手并在 Heroku 上部署,尝试推送到 Heroku,安装依赖项时出现此错误:
The pipenv version looks funny not sure if that is correct or how to correct it if that is the error pipenv 版本看起来很有趣,不确定这是否正确,或者如果这是错误,如何纠正它
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 8 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (38/38), 83.94 KiB | 10.49 MiB/s, done.
Total 38 (delta 8), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.8.5
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18
remote: Traceback (most recent call last):
remote: File "/tmp/build_9fedd330/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 27, in _enumerate_items
remote: yield next(non_metadata), next(non_metadata)
remote: StopIteration
remote:
remote: return toml.loads(contents)
remote: File "/tmp/build_9fedd330/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/toml.py", line 307, in loads
remote: raise TomlDecodeError("Key group not on a line by itself.")
remote: toml.TomlDecodeError: Key group not on a line by itself.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
Not sure what the error is.不知道错误是什么。 Any help would be appreciated.任何帮助,将不胜感激。 I have removed some of the error list due to asking me for more details as to much code由于向我询问有关许多代码的更多详细信息,我删除了一些错误列表
If you have not yet done it, create a file with dependencies for your code and specify versions explicitly (example):如果您还没有这样做,请为您的代码创建一个包含依赖项的文件并明确指定版本(示例):
Flask==0.8
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1
distribute==0.6.24
gunicorn==0.14.2
requests==0.11.1
Then (if you didn't create it yet), set up a new virtual environment, install all the requirements and check that your code is running by using the python from this environment.然后(如果您尚未创建它),设置一个新的虚拟环境,安装所有要求并使用此环境中的 python 检查您的代码是否正在运行。
Install virtualenv: python3 -m pip install --user virtualenv
安装 virtualenv: python3 -m pip install --user virtualenv
Create a virtual environment: python3 -m venv env
创建虚拟环境: python3 -m venv env
Activate the virtual environment source env/bin/activate
激活虚拟环境source env/bin/activate
Install all the requirements pip install -r requirements.txt
安装所有要求pip install -r requirements.txt
Run your application in the same console where you activated the virtual environment.在您激活虚拟环境的同一控制台中运行您的应用程序。
The Heroku uses the following command for installing dependencies pip install -r requirements.txt
. Heroku 使用以下命令安装依赖pip install -r requirements.txt
。 So if it gives you error on your local machine you would know what's the problem.因此,如果它在您的本地机器上给您错误,您就会知道问题出在哪里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.