App Engine Console 1-0beta3.330900106084229577

Integrating With Your Application

App Engine Console's purpose in life is to provide a helpful mechanism to do application development from "within" the runtime. Once you get a console tied to your own application, you can test ideas, create models and entities in the datastore, track down tough bugs, or do anything else that the engine allows.

Prerequisites

First, get a basic app engine application running on your system. (See the Getting Started guide for instructions.)

Next, ensure that your application does not already use the /console/ path from within the site. To confirm this, start the development SDK normally and go to http://localhost:8080/console/. You should get a 404 error (a blank page by default—so check your logs). This is good because this is where the console interface will live.

Finally, ensure that you do not already have a console subdirectory in your application code base, because that is where the code will live.

Installing The Code

Go to the App Engine Console project page and download its zip file. Unpack this file in the topmost directory of your project (the one with your app.yaml in it). Everything will extract into one nice, clean subdirectory called console.

Enabling the Console

Edit your app.yaml file. Insert two stanzas directly beneath the "handlers" line.

handlers:
- url: /console/static
  static_dir: console/app/view/static

- url: /console.*
  script: console/app/console.py

# (The rest of your handlers go below this line)

Try It

Start the development SDK normally and go to http://localhost:8080/console/. If you see the Python banner and a prompt then you are finished! Poke around. Create some entities. Generate some log messages. See the usage instructions for more information.

Add Convenient Functions

As with the normal Python console, you need to import any modules, classes, etc. before you can use them. If you find yourself importing something often, consider adding it into the autoexec.py. Every time a console session begins, it will first run from autoexec import *.

For example, open autoexec.py and add the following code:

def is_dev():
    import os
    return os.environ['SERVER_SOFTWARE'].startswith('Dev')

Now you can use it easily at the console:

>>> is_dev()
True

Configuration and Security

App Engine Console is great to use in production (i.e., hosted at appspot.com), because it provides a powerful way to inspect and manage datastore and memcache content. However, before you deploy App Engine Console in production in your application, please go through the config.py file and make sure you are satisfied with these settings:

Variable Default Value Description
hide_from_invalid_users False When True, all console-related pages will return 404 (file not found) messages to unauthorized users. This "cloak mode" makes it hard or impossible for normal users to detect that the console is integrated with your site.
allow_any_user False When True, any user can use the production Python console once he has loggged in. (Not recommended)
analytics_id "" If you use Google Analytics, go to the dashboard for your site. Check the "id" value in the URL (not "scid"). When you set analytics_id to that value, the Dashboard will then give you an easy way to jump straight to your site's latest Google Analytics reports.
pastebin_subdomain "" If this string is non-empty, the integrated pastebin window will use that as a semi-private subdomain for the site. This can be useful to avoid the clutter of other peoples' pasted material.
require_login_during_development False When True, users must "log in" even when running in development mode from the App Engine SDK.
python_doc_linking True When True, many common modules, exceptions, and types will be rendered as HTML links to the on-line Python documentation for those objects.
python_doc "http://docs.python.org/dev" This URL is used as the base directory for links to the Python documentation. If you have your own copy of the documentation, you can set this to have the links go there instead.
Powered by Google App Engine
Valid HTML 4.01 Strict