Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 59 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,59 @@
# hw6 template

1. Fork a repository for yourself with the github "Fork" button.
2. Clone your repository to your local machine.
3. Start a local AppEngine server with `dev_appserver.py go/` or `dev_appserver.py python/` (depending on whether you're using Go or Python).
4. Add functionality and test your App by viewing the local instance at http://localhost:8080
5. Deploy your app to AppEngine with `gcloud app deploy go/` or `gcloud app deploy python/`
1. Note: the first time you do this, you'll have to first set up an AppEngine project via [Google Cloud Console](https://console.cloud.google.com/appengine/).
6. `git add .` and `git commit` and `git push` to upload your changes to your GitHub repository.
7. Send email to the STEP mailing list to show everyone your awesome App!

Feel free to repeat steps 3-7 as much as you like!
# Homework 6 Template

## Getting started

1. Fork a repository for yourself with the github `Fork` button.

1. Clone your repository to your local machine.

1. If command line utility `gcloud` is not available, download and install
[Google Cloud SDK](https://cloud.google.com/sdk/docs/quickstarts) (Japanese
guides evailable).

- Then install App Engine components for the programming language of your
choice.
- Go: `gcloud components install app-engine-go`
- Python: `gcloud components install app-engine-python
app-engine-python-extras`
- Run `gcloud init` to initialize the SDK and create a new Cloud Platform
project. This newly created Cloud Platform project will allow you to try
many Google Cloud Platform products, but we will only use Google App
Engine for this homework.
- If you already have Google Cloud SDK installed, run `gcloud components
update` to update to the latest version.

1. Start a local App Engine server with `dev_appserver.py go/` or
`dev_appserver.py python-flask/` (depending on whether you're using Go or
Python).

1. Add functionality and test your app by viewing the local instance at
http://localhost:8080.

1. Deploy your app to App Engine with `gcloud app deploy go/` or `gcloud app
deploy python-flask/`.

- The first time you deploy an App Engine app to your Cloud Platform
project, you will be asked to select a region for the location of your
App Engine app. Select `asia-northeast1` (Tokyo), `asia-northeast2`
(Osaka) or
[a region](https://cloud.google.com/compute/docs/regions-zones/) that is
close to you.
- Use `--version` flag to specify a version string manually, e.g. `gcloud
app deploy python-flask/ --version=python-flask-20190612`.

1. Test your app in production by accessing the target url shown in the command
line console. To access a specific app version, use
`https://{VERSION}-dot-{PROJECT_NAME}.appspot.com`, e.g.
https://python-flask-20190612-dot-my-project-name.appspot.com.

1. To stream production server logs in the command prompt console, run `gcloud
app logs tail -s default`. You can also use
[the web console](https://console.cloud.google.com/logs/viewer) to
view/stream server logs for debugging and troubleshooting.

1. `git add .` and `git commit` and `git push` to upload your changes to your
GitHub repository.

1. Send email to the STEP mailing list to show everyone your awesome app!

Feel free to repeat steps 4-10 as much as you like!
19 changes: 19 additions & 0 deletions python-flask/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Python pycache:
__pycache__/
# Ignored by the build system
/setup.cfg
7 changes: 1 addition & 6 deletions python-flask/app.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
api_version: 1
threadsafe: true
runtime: python27
runtime: python37

handlers:
- url: /.*
script: main.app
5 changes: 2 additions & 3 deletions python-flask/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route('/')
def root():
return render_template("hello.html")
return render_template('hello.html')

3 changes: 1 addition & 2 deletions python-flask/main_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

import main
import webtest
Expand Down