[PYTHON] Publish the site for free on Google App Engine (personal memorandum)

This page (How to launch a site for free using Google App Engine --EC studio technical blog http://bit.ly/1jIheMB) I was doing it myself with reference to, but due to recent specification changes, Deploy cannot be done with the method on the above page.

Therefore, make a note for the current latest version. Note that this memo is written assuming that it will be viewed at the same time as the above page.

Refer to the above page for getting a Google App Engine account, installing the SDK, and installing Python (2.x.x instead of 3.x.x).

Then launch Google App Engine Launcher from your desktop shortcut. If you get an error like looking at the log here, Check "google_appengine_launcher.ini" in "C: \ Users \ username \ Google". If there is something like "[0]" or "[1]" in the description, delete it.

Next, I register the application as shown on the above page. If you are using Windows 8 or later and the user name is double-byte characters, it may not work well, so Specify the working folder directly under the local disk.

Try deploying it and see if it works. You can close it when the message "You can close this window now." Is displayed.

From here, start work to launch the site on Google App Engine

First, create the "htdocs" folder in the working folder specified when you registered the application earlier. Put all index.html etc. in this.

Next, when you open "app.yaml" in the same folder with Notepad etc., it looks like this. (“*****” is the name of the application you decide)

app.yaml


application: *****
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

The following handlers are rewritten as follows.

app.yaml


application: *****
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: (.*)/
  static_files: htdocs\1/index.html
  upload: htdocs(.*)/index.html
 
- url: /(.*)
  static_files: htdocs/\1
  upload: htdocs/(.*)

Now you can build the same state as the above page. After that, try deploying, check if htdocs / index.html is displayed, If it is displayed, it is successful.

When registering two or more applications, If there is an error when exiting the SDK, or if there is a problem such as only one application being displayed at startup There is a high possibility that the description of "google_appengine_projects.ini" in "C: \ Users \ username \ Google" is incorrect for some reason. If you look at the contents and there are multiple "[0]" or "[1]", rewrite them in order from the bottom like [0], [1] ..., and it will be correct. Can be displayed with SDK.

Recommended Posts

Publish the site for free on Google App Engine (personal memorandum)
Tweet (API 1.1) on Google App Engine for Python
PIL with Python on Windows 8 (for Google App Engine)
Until you run a Flask application on Google App Engine for the time being
Use ndb.tasklet on Google App Engine
[Python] Run Flask on Google App Engine
Use external modules on Google App Engine
Check when the HTML obtained by Requests on Google App Engine is garbled
Deploy a Django application on Google App Engine (Python3)
(Beginner) Basic usage of Datastore on Google App Engine
Getting Started with Google App Engine for Python & PHP
How to use Django on Google App Engine / Python
Do you have any recommendations for a commentary book on Google App Engine / Python development?
Deploy your Go app on Google App Engine with GitHub Actions
Script for backing up folders on the server to Google Drive
Building a development environment with Maven on Google App Engine [Java]
Using properties files with Flexible Environment Java 8 on Google App Engine
Google App Engine development with Docker
Java 1 1 support from Google App Engine
Detect app releases on the App Store
Deploy the Flask app on Heroku
Deploy the Flask app on heroku
Deploy a Python app on Google App Engine and integrate it with GitHub