I am currently trying to link a Realtime Database with Python Flask.
Currently when linking Python to the database however, it does not detect it. Instead, it defaults to: "The requested URL was not found on this server."
What could be the source for this issue? Here is my code so far, if it helps provide any context.
from firebase_admin import credentials, db
import json
cred = credentials.Certificate("App Interface\key.json")
firebase_admin.initialize_app(cred, {'databaseURL': 'https://console.firebase.google.com/u/2/project/<MY PROJECT NAME>/database/<MY PROJECT NAME>-default-rtdb/data/~2F'})
ref = db.reference('/')
#Problem occurs here. I can not add any information to the database without it
#causing the previously mentioned error.
users_ref = ref.child('users')
users_ref.set({
'alanisawesome': {
'date_of_birth': 'June 23, 1912',
'full_name': 'Alan Turing'
},
'gracehop': {
'date_of_birth': 'December 9, 1906',
'full_name': 'Grace Hopper'
}
})
CodePudding user response:
That's URL of the Firebase Realtime Database console. This is the databaseURL
that you need: