简体   繁体   English

在heroku上部署python flask应用程序会给functools32带来错误

[英]deploying python flask app on heroku gives error with functools32

First question on stackoverflow :D (because I found almost everything until now). 关于stackoverflow的第一个问题:D(因为我发现几乎所有东西直到现在)。

I try to deploy my python app to Heroku, but the following error appears: 我尝试将我的python应用程序部署到Heroku,但出现以下错误:

git push heroku master
Counting objects: 7036, done.
Compressing objects: 100% (3933/3933), done.
Writing objects: 100% (7036/7036), 10.97 MiB | 338.00 KiB/s, done.
Total 7036 (delta 2020), reused 7021 (delta 2014)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.6.2
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Collecting aniso8601==1.2.1 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 1))
remote:          Downloading aniso8601-1.2.1.tar.gz (62kB)
remote:        Collecting click==6.7 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 2))
remote:          Downloading click-6.7-py2.py3-none-any.whl (71kB)
remote:        Collecting cycler==0.10.0 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 3))
remote:          Downloading cycler-0.10.0-py2.py3-none-any.whl
remote:        Collecting deap==1.0.2.post2 (from -r 
remote:        Collecting Flask==0.12.2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 5))
remote:          Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
remote:        Collecting Flask-RESTful==0.3.6 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 6))
remote:          Downloading Flask_RESTful-0.3.6-py2.py3-none-any.whl
remote:        Collecting functools32==3.2.3.post2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 7))
remote:          Downloading functools32-3.2.3-2.zip
remote:            Complete output from command python setup.py egg_info:
remote:            This backport is for Python 2.7 only.
remote:            
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l0v0636d/functools32/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to XXXXXXX (servername by Heroku).
remote: 

On my virtual box everything works fine if I do 在我的虚拟盒子上,如果我这样做,一切正常

pip install -r requirements.txt

I tried the following with no avail: 我尝试了以下但无济于事:

  • changing functools32 version 改变functools32版本
  • Removing functools from requirements text, which made me realize it is a dependency by Flask for decorators :( 从需求文本中删除functools,这让我意识到它是Flask对装饰器的依赖:(

Answer (thanks to the comments): I didn't realize that I used python 2.7 (again, I am a beginner) in my virtualenv. 回答(感谢评论):我没有意识到我在virtualenv中使用了python 2.7(再次,我是初学者)。 Seems that using then the functools somewhere automatically installed the functools32 package which ports the functools from python 3 to 2. Heroku is using python 3 by default, so that is why functools32 is probably not available. 似乎使用functools在某处自动安装了functools32软件包,它将functools从python 3移植到2.默认情况下,Heroku使用python 3,这就是为什么functools32可能无法使用的原因。

I now installed a python 3 virtual environment thanks to this post , ported the few things I hat to port from 2 to 3 and everything works like a charm. 我现在安装了一个python 3虚拟环境,感谢这篇文章 ,将我要处理的一些东西移植到2到3之间,一切都像魅力一样。

Thanks to davidism & dimmg to point me into the right direction. 感谢davidism和dimmg指出我正确的方向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM