In this hands-on Lab, we create and deploy a simple App Engine application using Googl Cloud shell
The Following Tasks will be performend to achieve above objectives
-
Intialize App Engine
-
Preview an App Engine application running locally in Cloud Shell
-
Deploy an App Engine application for that others can reahc it
-
Disable an App Engine application when you nolonger need it.
-
In the Cloud Shell, Initialize App Engine with your project and Choose a region
gcloud app create --project=$DEVSHELl_PROJECT_IDwhen prompted, select the region in the Lab such as us-central1
-
Clone the source for sample application in the hello_world directory
git clone https://github.org/GoogleCloudPlatform/python-docs-samples -
navigate to the source directory
cd python-docs-samples/appengine/standard_python3/hello_world
-
At the Cloud Shell Prompt, run this command:
audo apt-get update -
Setup environment in which to run the application using python virtual environments
sudo apgt-get install virtualenvif prompted [Y/n], press
Yand thenEntervirtualenv -p python3 venv -
Activate th enew virtual environment like this
source venv/bin/activate -
Install dependencies; this must be done within your project directory
pip install -r requirements.txt -
Run the Application
python main.pyIgnore any warnings
-
Preview the Application by Clicking on Web Preview > Preview on port 8080
To access Web Preview icon, collapse the navigation menu
-
End the Test by typing Ctrl+C in the Cloud Shell.
-
Notic that in the Cloud Console Dashboard, no application is deployed.
- Naviagte to source directory
cd ~/python-docs-samples/appengine/standard_python3/hello_world
-
deploy the Application
gcloud app deployIncase you are prompted, Press
YthenEnter -
Launch Browser to preview App at http://YOUR_PROJECT_ID.appspot.com
gcloud app browserReplace PROJECT_ID with the actual project ID in your Cloud Shell
4.Copy and paste the url into a browser window to view App Content.
develop