Profiles

gae/handlers/oauth.py and gae/handlers/email_auth.py request handlers are responsible for processing OAuth and email user authentication.
USER_ATTR dictionary in gae/handlers/oauth.py defines how user fields map between different services (identity providers) and the app's internal user model. The rest is a lot of smart Python code you needn't worry about.
No one is signed in. Sign in with:

Sessions

Sessions are tracked by encrypted, client-side cookies. COOKIE_TEMPLATE variable in gae/settings.py defines the cookie content, and session dictionary can be accessed in every request handler.

Reload this page. The number of pageviews should increase.

Pageviews: 1

Full CRUD access to models is supported via POST, PUT, GET, and DELETE AJAX calls. See gae/static/js/script.js for sample code. The calls are routed via BaseRESTHandler in gae/handlers/common.py
The forms below are automatically generated from model definitions in gae/code/model.py. generate_model_form() in gae/core/model.py converts the model to a dictionary of template variables, and gae/static/templates/forms.html macro generates the corresponding HTML.

Create Entity

Heads up! Only logged in users are authorized to create new entities. See Security tab for how to modify these rules for your app.

Update/Delete Entity

Heads up! Only logged in users are authorized to delete entities. See Security tab for how to modify these rules for your app.
ID Summary Action
86001 {"int_field":266634666,"email_field":"bit@bot2222.com","boolean_field":false,"date_field":"12-02-2012","text_field":"testiram","id":86001,"string_field":"234","link_field":"http://test.com"}
65001 {"int_field":2332444,"email_field":"jaas@sdasd.com","boolean_field":false,"date_field":"15-02-2012","text_field":"asdasdasdgj","id":65001,"string_field":"asdfasdf","link_field":"http://test.com"}

If this text appears in blue, then LESS stylesheets are working.

gae/static/css/less/app.less contains application-specific styles. You can recompile updated styles by running npm run-script less from gae/static

If npm run-script less command fails:

  • Install npm.
  • Run npm init
  • Accept all defaults (keep pressing Enter)
  • Run $ npm install less --save to install LESS
  • Run $ npm install uglify-js --save to install Javascript minimizer.
  • Run $ npm run-script less; npm run-script js to generate site CSS and minified Javascript.

Algae is designed to get you app running on Google App Engine in less than 3 minutes and 42 seconds. Guaranteed, or your money back.

Algae integrates de facto industry standards (like Twitter Bootstrap and HTML5 Boilerplate) with features every web app needs (like user management and third-party authentication). It's flexible, functional, and easy to use.

Here is what you get:

  • HTML5 Boilerplate
  • Twitter Bootstrap
  • LESS Stylesheets + Font Awesome
  • User account framework, including:
    • Twitter authentication
    • Google authentication
    • Facebook authentication
    • Email authentication
    • Others (Work in progress)
  • Plain and RESTful style API bootstrap code:
    • Auto-generate HTML forms from GAE data model
    • Seamless entity CRUD via AJAX
  • jQuery form validation
  • Basic testing infrastructure (Work in progress)
  • and more..

Finally, a GAE template to write home about!

A Python decorator -- @with_login -- can be used on any method of BaseHandler or BaseAPIHandler (or their subclasses) to prevent unauthenticated users from viewing certain pages or calling APIs.

For instance, this page can only be viewed after you login.

Simply run $ python tests/testrunner.py /usr/local/google_appengine . from command line to execute unit and API tests.

If the above command fails, make sure that webtest and unittest2 Python modules are installed and that APPLICATION_ID and SERVER_SOFTWARE environment variables are set correctly, as they are required by testrunner.py script to run.

Here is how to set environment variables:

  • $ export SERVER_SOFTWARE=Dev
  • $ export APPLICATION_ID=green-algae

Algae comes preconfigured for internationalization, so your application can speak multiple languages.

To use this feature, make sure you have both jinja2 and babel installed to compile the translations for Algae.

These steps are needed for creating a multilanguage application:

  • Configure the locales
  • Prepare code & templates for i18n
  • Extract strings into separate messages file
  • Translate the messages into all needed languages
  • Compile message files
Configure the locales

In settings.py you find the list of the supported locales. Update this list according to your needs.

Prepare code & templates for i18n

In essence this boils down to putting any language-specific text into a sequence of {% trans %} - {% endtrans %} in the jinja2-template files and into a sequence of _(' - ') in the python files.

Each python file will need to add an import for this to work:
from webapp2_extras.i18n import gettext as _

Some special handling is possible in the jinja2-templates, see i18n in templates from the jinja2 documentation.

And in case your template contains almost only text which has to be translated, you can create a separate template file per language and reference the template in the python code with _('').
You will then treat the name of the template as a language-dependent text, which could be 'template.html' for English and 'template.html.de' for German.

Extract strings into separate messages file

In this step you extract all the strings in the templates and python files into a translation template.

Use the following command:

$ pybabel extract -F ./babel.cfg -o ./locale/messages.pot ./

Translate the messages into all needed languages

The very first time when you start your application or when you add a new language you can enter the command:

$ pybabel init -l en_US -d ./locale -i ./locale/messages.pot

However, once you have started with translating text into a language you should use the command

$ pybabel update -l en_US -d ./locale -i ./locale/messages.pot

The 'update' will preserve old translations.

Now you find in the folder ./locale/en_US a file named message.po which you can edit and add valid translations for the locale.

Compile message files

In this last step you are optimizing the messages files for runtime.

Use the following command for this purpose:

$ pybabel compile -f -d ./locale


Additional instructions can be found here and here.

View this page in German

Change Email Address

Heads up! Only logged in users can change their email address. You can login here.

Add To Mailing List