为什么我的Flask应用程序在Heroku上被检测为node.js [英] Why is my Flask app being detected as node.js on Heroku
问题描述
我所做的更改包括将npm和bower集成到我的应用程序中,以简化应用程序的JavaScript开发。
当我添加 package.json
当我开始使用npm时,我的根目录。看起来,构建检测脚本首先运行nodejs检测( here )导致这个代码: if [-f $ 1 / package.json];那么
执行,Heroku认为它是一个nodejs应用程序,并在python检测有机会运行之前退出。
会回显Node.js&&退出0
为了解决这个问题,我不得不手动告诉Heroku,我想用这个命令来构建一个python。
$ b $ p code> heroku config:设置BUILDPACK_URL = https://github.com/heroku/heroku-buildpack-python 。
I recently made some changes to the structure of my Flask app hosted on heroku and now heroku has decided to detect it as a Node.js app intead of a Python app. My application uses both python (Flask) for the backend api and javascript for the front end.
The changes I made included integrating npm and bower into my application to streamline the javascript development of the app.
The problem was introduced when I added a package.json
to my root directory when I started using npm. It seems that the build detection script runs the nodejs detection first (here) which leads to this code: if [ -f $1/package.json ]; then
echo "Node.js" && exit 0
executing and Heroku thinks it's a nodejs app and exits before the python detection has a chance to run.
To solve this I had to manually tell Heroku that I wanted a python build using this command
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python
.
这篇关于为什么我的Flask应用程序在Heroku上被检测为node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!