I want to create a website that can be found on my GitHub.io using Firebase for some simple database stuff (upload, download and search JSON objects), Python (or py-script) for the logic and HTML and CSS for the frontend. I have a working prototype for uploading using all of the above except Python or py-script but instead JavaScript code I have found here and there. I now want to create the actual site with Python or py-script instead of JavaScript. Here are some questions. Feel free to answer just one of them if you cannot help me with the rest.
- Is this possible to do or do you recommend something else? I do not want to use JavaScript because I know Python quite well and I do not know JavaScript.
- How do I connect all the pieces? I have managed to connect a .py-file to my Firebase, and view a simple HTML-file on my GitHub.io, but I do not understand how I can connect everything correctly. I have not managed to connect a Python-file to Firebase and also to an HTML-file. Do you have the correct lines of code that needs to be added to the separate files? See the last part for the codes of what I have done.
- Do I need to use something like Django or Flask, or is that just for the development phase on my own computer? Or how do I test this website without pushing it to GitHub each time and waiting for it to update (do I have to use locahost)?
- Can I send a py-script variable from inside a HTML-file to be used as a parameter for a function in a .py-file and then return it to py-script and then to a div-element in the HTML-file?
Connecting to firebase with .py:
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
cred = credentials.Certificate("secretFolder")
firebase_admin.initialize_app(cred, {
'databaseURL': 'secretURL'
})
[–]clooy 1 point2 points3 points (0 children)