簡體   English   中英

在heroku上部署python flask應用程序會給functools32帶來錯誤

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

關於stackoverflow的第一個問題:D(因為我發現幾乎所有東西直到現在)。

我嘗試將我的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: 

在我的虛擬盒子上,如果我這樣做,一切正常

pip install -r requirements.txt

我嘗試了以下但無濟於事:

  • 改變functools32版本
  • 從需求文本中刪除functools,這讓我意識到它是Flask對裝飾器的依賴:(

回答(感謝評論):我沒有意識到我在virtualenv中使用了python 2.7(再次,我是初學者)。 似乎使用functools在某處自動安裝了functools32軟件包,它將functools從python 3移植到2.默認情況下,Heroku使用python 3,這就是為什么functools32可能無法使用的原因。

我現在安裝了一個python 3虛擬環境,感謝這篇文章 ,將我要處理的一些東西移植到2到3之間,一切都像魅力一樣。

感謝davidism和dimmg指出我正確的方向。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM