|
| 1 | +Setup Project |
| 2 | +============= |
| 3 | + |
| 4 | +Before you can add Firebase to your Python app, you need to |
| 5 | +create a Firebase project and register your app with that |
| 6 | +project. When you register your app with Firebase, you'll |
| 7 | +get a Firebase configuration object that you'll use to |
| 8 | +connect your app with your Firebase project resources. |
| 9 | + |
| 10 | + |
| 11 | +Create a Firebase project |
| 12 | +------------------------- |
| 13 | + |
| 14 | +1. In the `Firebase console`_, click **Add project**. |
| 15 | + |
| 16 | + * To add Firebase resources to an existing Google Cloud project, |
| 17 | + enter its project name or select it from the dropdown menu. |
| 18 | + |
| 19 | + * To create a new project, enter the desired project name. You |
| 20 | + can also optionally edit the project ID displayed below the |
| 21 | + project name. |
| 22 | + |
| 23 | + .. attention:: |
| 24 | + |
| 25 | + Firebase generates a unique ID for your Firebase project based |
| 26 | + upon the name you give it. If you want to edit this project |
| 27 | + ID, you must do it now as it cannot be altered after Firebase |
| 28 | + provisions resources for your project. Visit |
| 29 | + `Understand Firebase`_ Projects to learn about how Firebase |
| 30 | + uses the project ID. |
| 31 | + |
| 32 | +2. If prompted, review and accept the Firebase terms. |
| 33 | + |
| 34 | +3. Click **Continue**. |
| 35 | + |
| 36 | +4. (Optional) Set up Google Analytics for your project. |
| 37 | + |
| 38 | + .. note:: |
| 39 | + |
| 40 | + You can always set up Google Analytics later in the |
| 41 | + |integrations|_ tab of your :fa:`gear; 2em` Project settings. |
| 42 | + |
| 43 | +5. Click **Create project** (or **Add Firebase**, if you're using |
| 44 | + an existing Google Cloud project). |
| 45 | + |
| 46 | +Firebase automatically provisions resources for your Firebase project. |
| 47 | +When the process completes, you'll be taken to the overview page for |
| 48 | +your Firebase project in the Firebase console. |
| 49 | + |
| 50 | +.. _Firebase Console: https://console.firebase.google.com |
| 51 | +.. |integrations| replace:: *integrations* |
| 52 | +.. _integrations: https://console.firebase.google.com/u/0/project/_/settings/integrations |
| 53 | +.. _Understand Firebase: https://firebase.google.com/docs/projects/learn-more#project-id |
| 54 | + |
| 55 | + |
| 56 | +Setup Realtime Database |
| 57 | +^^^^^^^^^^^^^^^^^^^^^^^ |
| 58 | + |
| 59 | +``databaseURL`` key is not present by default in the Firebase |
| 60 | +configuration when an app is :ref:`registered<guide/setup:Register your app>`. |
| 61 | +It is recommended to setup database before |
| 62 | +:ref:`registering an app<guide/setup:Register your app>`. |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +Register your app |
| 67 | +----------------- |
| 68 | + |
| 69 | +After you have a Firebase project, you can register your web app with |
| 70 | +that project. |
| 71 | + |
| 72 | +1. In the center of the `Firebase console's project overview page`_, |
| 73 | + click the **Web** icon (:fa:`code; fa-solid; 2em`) to launch the |
| 74 | + setup workflow. |
| 75 | + |
| 76 | + | If you've already added an app to your Firebase project, |
| 77 | + click **Add app** to display the platform options. |
| 78 | +
|
| 79 | +2. | Enter your app's nickname. |
| 80 | + | This nickname is an internal, convenience identifier |
| 81 | + and is only visible to you in the Firebase console. |
| 82 | +
|
| 83 | +3. Click **Register app**. |
| 84 | + |
| 85 | +4. | Copy the Firebase configuration dict shown in the screen, and |
| 86 | + store it use to connect to your project later in code example |
| 87 | + part. |
| 88 | + | The dict should be of the architecture shown below: |
| 89 | +
|
| 90 | + .. code-block:: python |
| 91 | +
|
| 92 | + config = { |
| 93 | + "apiKey": "apiKey", |
| 94 | + "authDomain": "projectId.firebaseapp.com", |
| 95 | + "databaseURL": "https://databaseName.firebaseio.com", |
| 96 | + "projectId": "projectId", |
| 97 | + "storageBucket": "projectId.appspot.com", |
| 98 | + "messagingSenderId": "messagingSenderId", |
| 99 | + "appId": "appId" |
| 100 | + } |
| 101 | + .. |
| 102 | +
|
| 103 | +5. Click **Continue to console**. |
| 104 | + |
| 105 | +.. _Firebase console's project overview page: https://console.firebase.google.com |
0 commit comments