【问题标题】:FLASK Python Heroku deployment issuesFLASK Python Heroku 部署问题
【发布时间】:2018-08-28 19:50:53
【问题描述】:

我正在尝试将一个应用程序部署到 heroku,它是一个非常简单的应用程序,但是当我尝试使用 push heroku master 进行部署时,我收到以下错误

(env) PS C:\Users\xblade\Desktop\F1> git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 465 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Collecting click==6.7 (from -r /tmp/build_351795e51ca44a70ac39d32b8fa95475/requirements.txt (line 1))
remote:          Downloading click-6.7-py2.py3-none-any.whl (71kB)
remote:        Collecting Flask==0.12.2 (from -r /tmp/build_351795e51ca44a70ac39d32b8fa95475/requirements.txt (line 2))
remote:          Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
remote:        Collecting Flask-SQLAlchemy==2.3.2 (from -r /tmp/build_351795e51ca44a70ac39d32b8fa95475/requirements.txt (line 3))
remote:          Downloading Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl
remote:        Collecting Flask-WTF==0.14.2 (from -r /tmp/build_351795e51ca44a70ac39d32b8fa95475/requirements.txt (line 4))
remote:          Downloading Flask_WTF-0.14.2-py2.py3-none-any.whl
remote:        Collecting itsdangerous==0.24 (from -r /tmp/build_351795e51ca44a70ac39d32b8fa95475/requirements.txt (line 6))
remote:          Downloading itsdangerous-0.24.tar.gz (46kB)
remote:            Complete output from command python setup.py egg_info:
remote:            /app/.heroku/python/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'zip_safe'
remote:              warnings.warn(msg)
remote:            usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
remote:               or: -c --help [cmd1 cmd2 ...]
remote:               or: -c --help-commands
remote:               or: -c cmd --help
remote:
remote:            error: invalid command 'egg_info'
remote:
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-huroui6_/itsdangerous/
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy....
remote:
remote: !       Push rejected to boiling-crag-24883.
remote:
To https://git.heroku.com/boiling-crag-24883.git
 ! [remote rejected] master -> master (pre-receive hook declined)

这似乎与requirements.txt 有关。

它试图安装一些pip 要求但它失败了。

我认为这与distutils 有关。我尝试上传,除了 1 之外没有任何要求,它工作正常(但应用程序不起作用)。

问题似乎在于烧瓶包及其附加包,例如itsdangerous

这是 requirements.txt 中的包列表

click==6.7
Flask==0.12.2
Flask-SQLAlchemy==2.3.2
Flask-WTF==0.14.2
gunicorn==19.7.1
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
psycopg2==2.7.4
SQLAlchemy==1.2.5
Werkzeug==0.14.1
WTForms==2.1

有谁知道为什么这个部署会失败,我可以做些什么来解决它?

谢谢

【问题讨论】:

  • 我最终获取了项目的所有文件并重新制作了一个新的 git 存储库和一个新的 heroku 应用程序,它现在工作正常,但原来的仍然无法工作,我不知道为什么。另一个项目和应用程序中的相同文件可以完美运行。

标签: python heroku flask-wtforms heroku-toolbelt


【解决方案1】:

我在这里找到了更好的解决方案,您可以在命令行中使用以下两个命令来解决此问题

$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache

请在此处找到解决方案的链接 https://github.com/heroku/heroku-buildpack-python/issues/661#issuecomment-374183119

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-19
    • 1970-01-01
    • 2015-06-05
    • 2017-12-05
    • 2016-05-11
    • 2017-05-04
    • 2013-06-17
    相关资源
    最近更新 更多