Sometimes I have to put text on a path

Saturday, July 2, 2011

first steps for dummies: google-appengine-mac-launcher; Google App Engine SDK for Python

This post is a tutorial for "dummies v0.0.0.1".
you will learn:
  • Google-appengine-mac-launcher - the Mac Launcher for Google App Engine  
  • Google Project Hosting.
  • the full steps from a code to your "NameApplication.appspot.com"
Download-----------------------------------------
Download the Google App Engine SDK for Python:
http://code.google.com/appengine/downloads.html
http://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.5.1.dmg
(version 1.5.1 - 2011-06-20)

GoogleAppEngineLauncher-1.5.1.dmg is an image disk of 12.3 MB (on your local disk;) ).
GoogleAppEngineLauncher is a Mac application (60MB on your local disk).
Google App Engine Launcher helps you develop and deploy web applications for Google App Engine using your Macintosh computer. Using the Launcher, you can create a new project, launch your editor to write code and change configuration, test your application, and upload your application to App Engine. The Launcher includes the complete App Engine software development kit, so it's all you need to get started.

--A) for the first use of this desktop program,  you get this message:
-------A-1
"The Google App Engine SDK contains command-line programs used by GoogleAppEngineLauncher.app.  Would you like symbolic links for these programs, such as dev_appserver.py, to be made in /usr/local/bin?
This action will replace links which may currently exist."
--------click OK
and 
----------A-2
"Symbolic links in /usr/local/bin have been created for the following commands:
appcfg.py bulkload_client.py bulkloader.py dev_appserver.py gen_protorpc.py remote_api_shell.py 
In addition, /usr/local/google_appengine points to the SDK."
---------------click OK

--B)-----------a brief overview of this stand-alone  application  before diving:
 At this URL (http://code.google.com/p/google-appengine-mac-launcher/), you can see the Launcher window with three projects. The first project is currently running locally on port 8080. The second project, selected, is running on port 8081. The Log Console for this project is also open. You can stop it, navigate to the local application in a browser, deploy it to appspot.com, and see the project dashboard. The last project is not running.

--C)------ In the help menu, select "demos" item  and "guestbook".
Google App Engine Launcher includes a fully functional demo application (hello-guestBook) that you can create, run and modify (for this demo application with Go (and not Python): see http://ex-ample.blogspot.com/2011/06/account-google-app-engine.html).


---D---------Hello-guestbook
--D)-1)---The Python SDK includes a web server application that simulates the App Engine environment, including a local version of the datastore, Google Accounts, and the ability to fetch URLs and send email directly from your computer using the App Engine APIs. The Python SDK runs on any computer with Python 2.5, and versions are available for Windows, Mac OS X and Linux. (The Python SDK is not compatible with Python 3.)
The Python SDK (for Windows and Mac) includes Google App Engine Launcher, an application that runs on your computer and provides a graphical interface that simplifies many common App Engine development tasks.

Python App Engine applications communicate with the web server using the CGI standard. When the server receives a request for your application, it runs the application with the request data in environment variables and on the standard input stream (for POST data). To respond, the application writes the response to the standard output stream, including HTTP headers and content.
Let's begin by implementing a tiny application (hello) that displays a short message.

--D-2)---first steps "run"
 a)click on the menu item "demo" (Google App Engine Launcher):

b) click "run" and click "logs",
c) The local app server starts, and the green "running" icon appears next to the project in the project list.
Click the "Browse" button. A web browser window (chrome) opens with the demo application's home page:

d)Test the application: In the browser window, select the text box on the page, enter some text (i.e. "first ex-ample", then click the "Sign Guestbook" button:

The application responds by adding the message to the page:

Try again with another message:


--D-3)---first steps :To modify the demo application. "Iterative Development"
a) In the Launcher window, click the "Edit" button (or select Edit -- Open in External Editor)
A text editor (application "text edit") opens with the files for the project (app.yaml).


The directory "guestbook" contains 2 files:

In the text editor, open the file named "guestbook.py" (. Find the line containing "An anonymous person wrote:". Change the phrase to "ex-ample(anonymous) wrote:", or another phrase of your choosing 
Tip: You do not need to restart the local app server for most changes to application source files. If the server is still running from a previous step, you can leave it running.

Select the browser window, then reload the page. Previously entered messages are displayed, but with the new phrase ("ex-ample(anonymous) wrote:").

To view the log data for a project running under the local app server:
click the "Logs" button.

--D--4)----To deploy a project to Google App Engine:
If you have not already done so, sign in or register with Google App Engine (https://appengine.google.com/), then create an application ID for the application (see below).
Edit the project's app.yaml file to have the correct application ID (see the pictures below)
(YAML is a language: http://en.wikipedia.org/wiki/Yaml).


------------
Select the project in the project list.

Click the "Deploy" button (graphic UI of the google-appengine-mac-launcher; or use appcfg to upload and deploy your application code).

Account google app engine window:
An application ID = a name unique to this application. 
If you elect to use the free appspot.com domain name, the full URL for the application will be http://application-id.appspot.com/.

http://code.google.com/appengine/docs/python/gettingstarted/uploading.html

more : http://code.google.com/appengine/docs/python/tools/uploadinganapp.html
(Uploading, Downloading, and Managing a Python App: the App Engine Python SDK includes a command for interacting with App Engine named appcfg.py. You can use this command to upload new versions of the code, configuration and static files for your app to App Engine. You can also use the command to manage datastore indexes and download log data).

--D--5)----logs:

Starting update of app: hello-javascript, version: 1
Scanning files on local disk.
2011-07-03 18:12:17,212 WARNING appengine_rpc.py:435 ssl module not found.
Without the ssl module, the identity of the remote host cannot be verified, and
connections may NOT be secure. To fix this, please install the ssl module from
http://pypi.python.org/pypi/ssl .
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl . 
Password for xxxxx@gmail.com: Cloning 3 application files.
Uploading 2 files and blobs.
Uploaded 2 files and blobs
Compilation starting.
Compilation completed.
Starting deployment.
Checking if deployment succeeded.
Will check again in 1 seconds.
Checking if deployment succeeded.
Will check again in 2 seconds.
Checking if deployment succeeded.
Deployment successful.
Checking if updated app version is serving.
Completed update of app: hello-javascript, version: 1
If deploy fails you might need to 'rollback' manually.
The "Make Symlinks..." menu option can help with command-line work.
*** appcfg.py has finished with exit code 0 ***

You succeed!!!!
Your first "web application" is http://hello-javascript.appspot.com/

Try the "Dashboard" button:
You can manage and monitor applications running on Google App Engine using the Admin Console from your web browser. You can open the Admin Console directly from the Launcher.
With the project selected in the project list (google-appengine-mac-launcher),
click the "Dashboard" button.
A web browser window opens with the Google App Engine Admin Console for the selected project.
I get this:
https://appengine.google.com/dashboard?app_id=hello-javascript
Some remarks:
  • 3 paths were created: 1) a favicon was not added (err 404) but its path was created, 2) the path "/" and 3) the path "/sign".
  • go to "application settings": 1) Cookie Expiration: 1 day (App Engine uses a cookie to keep users logged in to your application); 2) you can select the Authentication Options: google account API or Federated login (openId); 3) YOU CAN DISABLE or DELETE YOUR APPLICATION HERE (http://code.google.com/appengine/kb/adminconsole.html#delete_app)
--D--6)---------now you can modify the demo application:
Sometimes if you modify the "guestbook.py"
you MUST modify "app.yaml" (for example if you want to add static file as image saved in your local  directory "/image"):
http://code.google.com/appengine/docs/python/config/appconfig.html


--D--7)------shut down the local web server
To shut down the web server, make sure the terminal window is active, then press Control-C (or the appropriate "break" key for your console), or click Stop in Google App Engine Launcher.
You can leave the web server running for the rest of this tutorial. If you need to stop it, you can restart it again by running the command above.


--E------- 
in fact, this demo partially corresponds to  the hello-guestbook step by step "getting started":

  1. http://code.google.com/appengine/docs/python/gettingstarted/helloworld.html
  2. http://code.google.com/appengine/docs/python/gettingstarted/usingwebapp.html
  3. http://code.google.com/appengine/docs/python/gettingstarted/usingusers.html
  4. http://code.google.com/appengine/docs/python/gettingstarted/handlingforms.html
  5. http://code.google.com/appengine/docs/python/gettingstarted/usingdatastore.html
    (Note: If you built your application using an earlier version of this Getting Started Guide, please note that the sample application has changed. You can still find the sample code for the original Guestbook application, which does not use ancestor queries, in the demos directory of the SDK)
  6. http://code.google.com/appengine/docs/python/gettingstarted/templates.html
  7. http://code.google.com/appengine/docs/python/gettingstarted/staticfiles.html


--F--------To add an other existing Google App Engine project to the launcher in 3 clicks:

      1----Select the menu option File -- Add an Existing Project...(or: Press Shift-Command-N).
      2----The "Add Existing Application" dialog opens. Click the "Browse..." button next to the field "Path" to select the existing application root directory.
The application root directory is the directory containing the application's app.yaml file.

(Optional) Change the port number to use when running the local app server for this project. By default, a port number is selected that doesn't conflict with any other project in the Launcher.

      3---Click the "Add" button. The project is added to the Launcher project list.

---------------end

No comments:

Post a Comment