我想创建一个必须从 firestore 恢复数据并将其公开为 json 的 API,但我面临以下错误:
Object of type GeoPoint is not JSON serializable
Run Code Online (Sandbox Code Playgroud)
怎么了?这是我的代码:
#!/usr/bin/env python
import firebase_admin
import json
from pprint import pprint as pp
from flask import Flask, flash, request, url_for, jsonify, Response
from firebase_admin import credentials
from firebase_admin import firestore
app = Flask(__name__)
cred = credentials.Certificate('xxxx.json')
firebase_admin.initialize_app(cred)
db = firestore.client()
@app.route('/')
def index():
markers_ref = db.collection(u'Test')
docs = markers_ref.get()
data = []
for doc in docs:
data.append(doc.to_dict())
json_data = json.dumps(data)
resp = Response(json_data, status=200, mimetype='application/json')
return …
Run Code Online (Sandbox Code Playgroud) python flask flash-message firebase firebase-realtime-database
我的应用程序正在生产中,我想在用户更新应用程序时管理用户数据而不会丢失他们的数据,我如何使用sqflite
. 明确地我想添加一列并删除另一列。
当我编写 flutter 应用程序时,我在 macOS 上遇到了这个问题,相同的基本代码在我的 Windows 电脑中工作,但在 macOS 中不起作用。正如您在我的日志中看到的,应用程序已连接,但我仍然无法对我的 Firestore 数据库发出请求
我改变了规则
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
Run Code Online (Sandbox Code Playgroud)
到
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我有同样的错误。
D/FirebaseAuth(11790): Notifying id token listeners about user ( tNGS8j375AYehEPDhZADPP80zLY2 ).
W/DynamiteModule(11790): Local module descriptor class for providerinstaller not found.
I/DynamiteModule(11790): Considering local module providerinstaller:0 …
Run Code Online (Sandbox Code Playgroud) macos firebase-security flutter google-cloud-firestore apple-m1