为什么我的Flask应用程序在Heroku上被检测为node.js [英] Why is my Flask app being detected as node.js on Heroku

查看:140
本文介绍了为什么我的Flask应用程序在Heroku上被检测为node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近对heroku上托管的Flask应用程序的结构做了一些更改,现在,heroku已经决定将它作为一个Python应用程序的Node.js应用程序intead来检测。我的应用程序使用python(Flask)作为后端api,而javascript作为前端。

我所做的更改包括将npm和bower集成到我的应用程序中,以简化应用程序的JavaScript开发。

解决方案

当我添加 package.json 当我开始使用npm时,我的根目录。看起来,构建检测脚本首先运行nodejs检测( here )导致这个代码: if [-f $ 1 / package.json];那么
会回显Node.js&&退出0
执行,Heroku认为它是一个nodejs应用程序,并在python检测有机会运行之前退出。

为了解决这个问题,我不得不手动告诉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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆