Eclipse + Pydev + GAE development

GAE development using Eclipse. The goal is to create a sample project, deploy to GAE, and check the operation. PC is Macbook Pro MacOS Sierra 64bit

[Reference site] http://westplain.sakuraweb.com/translate/GAE/Python/RuntimeEnvironment.cgi


Work list

  1. Install eclipse
  2. Create a sample project
  3. Deploy to GAE

1. Install eclipse

1.1 Select "Eclipse 4.6 Neon Pleiades All in One" at the following site

[Download site] http://mergedoc.osdn.jp/

1.2 Select [Python] for [Full Edition] of "Mac 64bit"

1.3 Double-click the downloaded file to install it in Applications

1.4 Start eclipse


2. Create a sample project

2.1 Select "File"-> "New"-> "Other"-> "PyDev", select "PyDev Google App Engine Project", and click "Next".

2.2 Enter the project information and click "Next" Project name: Sample

2.3 Enter the following in the Google App Engine Directory

/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine

2.4 Done

2.5 Create an empty project 「From Which Template do you want to create your new Google App Project?」 so Select "Empty Project"

2.6 Create a script Create the simplest sample source [helloworld.py] as below directly under the project


#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#Comments
#

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello World !')


app = webapp2.WSGIApplication([
    ('/.*', MainHandler)
], debug=True)

2.7 Creating app.yaml

application: sample-app-12461
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.ap

libraries:
- name: webapp2
  version: "2.5.2"
    

2.6 Debug execution (1) Debug execution (2) Check the log

The following log is output to the Eclipse console

(3) Check with a browser

http://localhost:8080


3. Deploy to GAE

I confirmed that it works locally, so I will deploy it to the actual GAE.

3.1 Upload to GAE

3.2 Check with GAE

Log in to the GCP management console, click "App Engine" → "Version", and it will be deployed as shown below, so click the version

Recommended Posts

Eclipse + Pydev + GAE development
Python with eclipse + PyDev.
Output debug log with GAE dev_appserver.py on Eclipse + PyDev
Mac + Eclipse (PyDev) + Django environment construction
Notes for using python (pydev) in eclipse