Quickstart for Deploying from Cloud Source Repositories to Google App Engine

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

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

Complete the steps from Quickstart Creating a Repository.

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

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 Google Cloud Platform account for the resources used in this quickstart:

To disable your application:

  1. In the GCP 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 source view in the GCP Console:

    Open the Source View in the Console

  2. Click the More button More button next to the repository you want to delete.

    Create Repository button

  3. Select Delete.

  4. When prompted for the repository name, enter hello-csr and then click Delete.

What's next

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

Send feedback about...

Cloud Source Repositories