python/django:部署到heroku失败
问题描述:
我想部署一个应用程序到heroku。 这是一个python/django应用程序,它在我的本地机器上运行良好。python/django:部署到heroku失败
部署时,heroku会下载requirements.txt中定义的包,但会停止抱怨qpython
无法建立,因为它找不到numpy
。但是从日志输出中可以看出numpy
正在被下载,并且在qpython之前安装。
我能想到的唯一的事情是日志实际上是说 “收集”和“下载”,但不明确“安装”...可能是因为Heroku处理这种方式导致qpython之前建立numpy正在安装?这是一个奇怪的假设,但我能想到的只有一个。无论如何,我不知道该怎么做。
我将python定义为runtime.txt中的python 2.7.12。
$ git push heroku-dev django6_12:master
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (21/21), 1.99 KiB | 0 bytes/s, done.
Total 21 (delta 16), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
/*...more output omitted for brevity */
remote: -----> Python app detected
remote: -----> Installing python-2.7.12
remote: -----> Noticed cffi. Bootstrapping libffi.
remote: $ pip install -r requirements.txt
/*...more output omitted for brevity */
remote: Collecting nodeenv==0.7.2 (from -r requirements.txt (line 36))
remote: Downloading nodeenv-0.7.2.tar.gz
remote: Collecting numpy==1.8.1 (from -r requirements.txt (line 37))
remote: Downloading numpy-1.8.1-cp27-cp27m-manylinux1_x86_64.whl (14.6MB)
remote: Collecting pandas==0.14.0 (from -r requirements.txt (line 38))
remote: Downloading pandas-0.14.0.zip (7.3MB)
/*...more output omitted for brevity
**Note how numpy is being installed** */
remote: Collecting qpython==1.0.0 (from -r requirements.txt (line 112))
remote: Downloading qPython-1.0.0.zip (75kB)
remote: Complete output from command python setup.py egg_info:
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-build-NoEaTG/qpython/setup.py", line 19, in <module>
remote: import numpy
remote: ImportError: No module named numpy
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-NoEaTG/qpython/
remote: ! Push rejected, failed to compile Python app.
$ git push heroku-dev django6_12:master
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (21/21), 1.99 KiB | 0 bytes/s, done.
Total 21 (delta 16), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
/*...more output omitted for brevity */
remote: -----> Python app detected
remote: -----> Installing python-2.7.12
remote: -----> Noticed cffi. Bootstrapping libffi.
remote: $ pip install -r requirements.txt
/*...more output omitted for brevity */
remote: Collecting nodeenv==0.7.2 (from -r requirements.txt (line 36))
remote: Downloading nodeenv-0.7.2.tar.gz
remote: Collecting numpy==1.8.1 (from -r requirements.txt (line 37))
remote: Downloading numpy-1.8.1-cp27-cp27m-manylinux1_x86_64.whl (14.6MB)
remote: Collecting pandas==0.14.0 (from -r requirements.txt (line 38))
remote: Downloading pandas-0.14.0.zip (7.3MB)
/*...more output omitted for brevity
**Note how numpy is being installed** */
remote: Collecting qpython==1.0.0 (from -r requirements.txt (line 112))
remote: Downloading qPython-1.0.0.zip (75kB)
remote: Complete output from command python setup.py egg_info:
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-build-NoEaTG/qpython/setup.py", line 19, in <module>
remote: import numpy
remote: ImportError: No module named numpy
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-NoEaTG/qpython/
remote: ! Push rejected, failed to compile Python app.
答
就像它说的那样,你需要安装numpy(它不会安装在使用pip的heroku上)。
你必须使用一个buildpack在您的Heroku应用程式安装numpy的:
真棒哥们,我搜索了很多的文件,但找不到这个任何参考!非常感谢。 – faboolous