Quickstart for deploying from Cloud Source Repositories to Google App Engine

This topic describes how to deploy from Cloud Source Repositories to App Engine.

This quickstart builds on the steps from Quickstart Creating a Repository. During this quickstart, you will make an update to the repository and redeploy the updated code.

Before you begin

  1. Complete the steps from Quickstart Creating a Repository.

    After you complete the quickstart, you should have an application you can deploy to App Engine.

  2. Enable the App Engine Admin API.

Deploy your application

  1. From a terminal window, navigate to the directory containing the repository.

    cd hello-world
    
  2. Deploy the sample application.

    gcloud app deploy app.yaml
    
  3. Verify that your application is running by typing the following command:

    gcloud app browse
    

    The browser window should now read:

    Hello world!
    

Update your application

  1. From a terminal window, use a text editor to update the main.py file to read as follows:

    #!/usr/bin/env python
    
    import webapp2
    
    class MainHandler(webapp2.RequestHandler):
        def get(self):
            self.response.write('Goodbye, Moon!')
    
    app = webapp2.WSGIApplication([
        ('/', MainHandler)
    ], debug=True)
    
  2. Add the file so Git can commit it.

    git add main.py
    
  3. Commit the file.

    git commit -m "Update main.py to say Goodbye Moon"
    
  4. Push the file to Cloud Source Repositories.

    git push origin master
    

Redeploy your application

  1. From a terminal window, type the following command:

    gcloud app deploy app.yaml
    
  2. Open your application.

    gcloud app browse
    

    The browser window should now read:

    "Goodbye, Moon!"
    

Clean up

To avoid incurring charges to your GCP account for the resources used in this quickstart:

To disable your application:

  1. In the console, go to the App Engine Settings page.

    Go to the App Engine Settings

  2. Click Disable application and follow the instructions.

    Disabling your app takes effect immediately.

  3. Confirm that your application has been disabled by visiting the URL of your app, such as http://[YOUR_PROJECT_ID].appspot.com/. Your application should return an HTTP 404 Not Found error.

To delete the repository you created:

  1. Open the All Repositories view for Cloud Source Repositories:

    Open Cloud Source Repositories

  2. Hover over the repository and click the Gear button.

    The General Settings screen opens.

  3. Click Delete This Repository.

    The Remove Repository screen opens.

  4. Type the name of the repository that you want to delete.

  5. Click Delete.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Source Repositories