简体   繁体   English

在Heroku上使用Python 3.5和Scipy部署Flask App

[英]Deploying Flask App using Python 3.5 and Scipy on Heroku

I'm try to use create a flask web app on Heroku that uses python 3.5, scipy and flask. 我尝试在Heroku上使用python 3.5,scipy和flask创建一个Flask Web应用程序。

It's well known I suppose that Heroku (still) can't install scipy on its platform. 众所周知,我猜Heroku(仍然)无法在其平台上安装scipy。 I'm wondering if anyone knows how to push a Flask app to Heroku that can use scipy. 我想知道是否有人知道如何将Flask应用程序推送到可以使用scipy的Heroku。 I know there are buildpacks that exist (like this one https://github.com/kennethreitz/conda-buildpack ) but they don't use the version of python I would like and doesn't seem to let gunicorn and flask do there web app thing. 我知道有存在的buildpack(像这样一个https://github.com/kennethreitz/conda-buildpack ),但是他们没有使用我想要的python版本, 而且似乎也没有让gunicorn和flask做网络应用程序的东西。

I don't know if that's clear enough so comment if there's anyway I can make it more clear. 我不知道这是否足够清楚,因此请评论一下是否可以让我更清楚。

EDIT I had to make a new buildpack that I will maintain since the one that I had previously was changed and now only supports Python 2.7 . 编辑我必须制作一个新的buildpack,因为以前已经更改了它,现在仅支持Python 2.7 ,所以我将对其进行维护。 Mine supports Python 3 . 我的支持Python 3

Here's step by step what you should do. 这是您应该逐步执行的操作。

1) Add this https://github.com/arose13/conda-buildpack.git to your BUILDPACK_URL 1)将此https://github.com/arose13/conda-buildpack.git添加到您的BUILDPACK_URL

2) Create a conda-requirements.txt with all your requirements that you need anaconda to get, here is where you include python version 3 and scipy. 2)创建一个conda-requirements.txt ,其中包含anaconda所需要的所有要求,此处包含python 3和scipy。 This can be done in command-line with... 可以在命令行中使用...

conda list -e > conda-requirements

3) Order matters in the conda-requirements.txt . 3)在conda-requirements.txt订购事宜。 It should look like this... 它应该看起来像这样...

numpy=1.10.1
scipy=0.16.0

4) requirements.txt contains all the requirements that you want pip to install. 4) requirements.txt包含您pip安装的所有要求。 You can use pip freeze > requirements.txt Just make sure that there's nothing on this list that is on the conda-requirements.txt list. 您可以使用pip freeze > requirements.txt只需确保此列表中没有conda-requirements.txt列表中的任何内容。

5) Push to Heroku. 5)推送到Heroku。

PS: github project example is here https://github.com/arose13/HerokuCondaScipyFlaskApp PS:github项目示例在这里https://github.com/arose13/HerokuCondaScipyFlaskApp

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

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