我正在尝试在 Heroku 上创建一个新应用程序,但由于某种原因部署不起作用。
我不知道为什么,但似乎 Heroku 尝试安装 SQLite3 但失败了。问题是我根本不使用它。 这是构建日志:
-----> Python app detected
-----> Installing python-3.7.5
-----> Installing pip
-----> Installing SQLite3
! Push rejected, failed to compile Python app.
! Push failed
这是我的runtime.txt 文件:
python-3.7.5
我的requirements.txt文件:
Flask==1.1.1
Flask-Cors==3.0.8
gunicorn==19.9.0
haversine==2.1.2
redis==3.0.1
过程文件:
web: gunicorn server:app
服务器.py:
# -*- coding: utf-8 -*-
from flask import (Flask, abort, request,
)
from flask_cors import CORS, cross_origin
from sessions import RedisSessionInterface
from firebase import Firebase
from datetime import timedelta, datetime
from haversine import haversine as distance
import os
import json
app = Flask(__name__)
cors = CORS(app)
app.session_interface = RedisSessionInterface()
app.secret_key = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=60)
app.config['CORS_HEADERS'] = 'Content-Type'
fb = Firebase()
@app.route('/')
def index():
return 'Hello'
if __name__ == '__main__':
app.run()
我一遍又一遍地尝试解决这个问题,但失败了。我尝试了找到的所有解决方案,但似乎没有任何效果。 (Stack Overflow 上这个问题的几乎所有答案都是“我在错误的分支”之类的) 请帮助我
最佳答案
这是 Heroku 的 Python 构建包中的一个错误。他们发布了修复程序 here .
基本上,它表示您可以切换正在使用的 buildpack 分支,或者手动指定不包含此错误的堆栈版本。
关于python - 无法将 Flask 应用程序部署到 Heroku(Heroku 尝试安装 SQlite,即使我根本不使用它),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59143652/