简体   繁体   English

推送 Python Flask 应用到 Heroku 失败

[英]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 检查您的代码是否正在运行。

  1. Install virtualenv: python3 -m pip install --user virtualenv安装 virtualenv: python3 -m pip install --user virtualenv

  2. Create a virtual environment: python3 -m venv env创建虚拟环境: python3 -m venv env

  3. Activate the virtual environment source env/bin/activate激活虚拟环境source env/bin/activate

  4. Install all the requirements pip install -r requirements.txt安装所有要求pip install -r requirements.txt

  5. 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.

相关问题 尝试将Python /烧瓶应用程序部署到Heroku时无法绑定到$ PORT - Failed to bind to $PORT when trying to deploy Python/flask app to Heroku Flask Python应用程序在Heroku上崩溃 - Flask python app crashes on heroku 没有 package 在推送到 heroku flask 应用程序时发现错误 - No package found error while pushing to heroku a flask app 将具有 heroku 数据库的 python flask 应用程序部署到 Z3115FB34DFCB5BA8AA049707C596B73Z3 - Deploy a python flask app with heroku database to heroku 为什么将 Flask 应用程序推送到 Heroku 失败? - Why did push of a Flask app to Heroku failed? 由于django_comments,将应用程序推送到Heroku失败 - Pushing app to Heroku failed because of django_comments 使用 python flask 应用程序部署到 heroku 时 Procfile / wsgi 出现问题 ~ 找不到属性 - Problem with Procfile / wsgi when deploying to heroku with python flask app ~ Failed to find attribute 在 Heroku 上推送 Flask Web 应用程序时出错-“请求的运行时不适用于此堆栈 (heroku-18)。” - Error while pushing Flask Web App on Heroku- "Requested runtime is not available for this stack (heroku-18)." 无法将Python 3 Flask应用程序推送到Heroku上 - Unable to push a Python 3 Flask app onto Heroku Flask,Python - 增加Heroku应用程序的超时长度 - Flask, Python - Increase timeout length on Heroku app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM