Skip to content

Instantly share code, notes, and snippets.

@bluemyria
Last active May 16, 2023 15:15
Show Gist options
  • Save bluemyria/8d1d27bbc63c8e3243c02f4ccc987535 to your computer and use it in GitHub Desktop.
Save bluemyria/8d1d27bbc63c8e3243c02f4ccc987535 to your computer and use it in GitHub Desktop.
CGP Dev 4. Adding User Authentication - Python
git clone https://github.com/GoogleCloudPlatform/training-data-analyst
cd ~/training-data-analyst/courses/developingapps/python/firebase/start
. prepare_environment.sh
python run_server.py
# Web preview > Preview on port 8080 to preview the Quiz application.
# Note Cloud Shell Web preview domain (in form: 8080-dot-2958229-dot-devshell.appspot.com)
# Create a Firebase project
# Develop > Authentication > Set up sign-in method > Email/Password > Enable
# Under Authorized Domains > Add Domain (in form: 8080-dot-2958229-dot-devshell.appspot.com)
# Project Overview > web icon > Register app > Copy Firebase SDK scripts
# in index.html file in ...webapp/static/client/ as first script
# below the firebase-app.js add =>
# <script src="https://www.gstatic.com/firebasejs/6.1.0/firebase-auth.js"></script>
#!/bin/bash
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
echo "Creating Datastore/App Engine instance"
gcloud app create --region "us-central"
echo "Creating bucket: gs://$DEVSHELL_PROJECT_ID-media"
gsutil mb gs://$DEVSHELL_PROJECT_ID-media
echo "Exporting GCLOUD_PROJECT and GCLOUD_BUCKET"
export GCLOUD_PROJECT=$DEVSHELL_PROJECT_ID
export GCLOUD_BUCKET=$DEVSHELL_PROJECT_ID-media
#echo "Creating virtual environment"
#mkdir ~/venvs
#virtualenv ~/venvs/developingapps
#source ~/venvs/developingapps/bin/activate
echo "Installing Python libraries"
sudo pip install --upgrade pip
sudo pip install -r requirements.txt
echo "Creating Datastore entities"
python add_entities.py
echo "Project ID: $DEVSHELL_PROJECT_ID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment