Search code examples
pythonfirebasefirebase-realtime-databasefirebase-hostingfirebase-tools

Run Python script with `firebase serve`


So I am working on a small project that includes Python and a Firebase realtime database. By now I have everything pretty much finished and the only thing I want to add is that it is hosted by Firebase as well.

Can one run a python file via the firebase servecommand in order to host my web-app using Firebase?


Solution

  • The Firebase CLI isn't meant for hosting. You're supposed to deploy your project to have it hosted in the cloud using the URL it provides for you.

    After you do that, bear in mind that it will only host static web assets like HTML, CSS, and JS. It will not run python programs. If you want to run code on your backend, you should look into integrating Firebase Hosting with Cloud Functions. You can run python in Cloud Functions.