
Google App Engine Boilerplate gets your project off the ground quickly using the Google App Engine platform. Create powerful applications by using the latest technology supported on Google App Engine. It will introduces new developers to App Engine and advanced developers to follow best practices.
A Boilerplate is used to describe sections of code that can be reused over and over in new contexts or applications which provides good default values, reducing the need to specify program details in every project. (wikipedia)
It is fully featured, actively maintained, and uses the latest and most supported technologies of Google App Engine.
New to Google App Engine? Learn about it by watching this video of @bslatkin or reading the official documentation.
Please note that boilerplate code is located in the boilerplate module while your custom application code should be located in the web module. The intention is that separating the boilerplate code from your application code will avoid merge conflicts as you keep up with future boilerplate changes. Settings, code, and templates in the root config.py, web module, and templates directory take precedence over the equivalent files in the boilerplate module.
Boilerplate has a Google group (gae-boilerplate) for discussions and a Twitter account (@gaeboilerplate) for sharing related resources.
If you want to add, fix or improve something, create an issue or send a Pull Request.
Before committing fixes we recommend running the unitests (in the boilerplate package). This will help guard against changes that accidently break other code. See the testing section below for instructions.
Feel free to commit improvements or new features. Feedback, comments and ideas are welcome.
Unit testing
+ Unit tests can be run via testrunner or in Eclipse by right clicking on the web folder and selecting "run as..." -> "Python unit-test".
+ You may need to add /boilerplate/external to your python path.
+ Please add unittests for your application to unittests.
+ To run unittests it may be necessary to install webtest, mock, and pyquery in your local python installation.
bash
sudo pip install webtest
sudo pip install mock
sudo pip install pyquery
+ Your own unittests can be created similarly to those in the boilerplate. Inheriting from boilerplate.lib.test_helpers.HandlerHelpers will provide access to convenient handler testing methods used by the boilerplate.
In each locale//LC_MESSAGES directory there is a file messages.po. Please help us translate the text in these files. msgid is the text in English. msgstr is the translation to the language indicated by the locale code. For example:
msgid "Change your password"
msgstr "Cambiar tu contraseña"
This boilerplate comes bundled with babel, pytz, and automatic language detection which together provide powerful internationalization capability. Text to be translated needs to be indicated in code and then translated by users like you after which it is compiled for speed.
Adding or updating text to be translated or adding new languages requires more work as indicated in the steps below:
_("text to translate") in *.py files.{{..._("text to translate")...}}{%..._("text to translate")...%}{% trans %}text to translate{% endtrans %}NOTE: Translations can be added to other types of files too. See babel.cfg
and babel.cfg documentation
1. Obtain pybabel to perform the steps below. You will need to install and compile jinja2 and babel.
Note that you may need to first install setuptools and easy_install.
pybabel.exe can be run from the Scripts directory in your python installation.
* easy_install jinja2 babel
1. Babel then needs to find all translationed text blocks throughout code and templates.
After installing pybabl run this command to extract messages (assuming ./ is the location of this boilerplate):
pybabel extract -F ./locale/babel.cfg -o ./locale/messages.pot ./ --sort-output --no-location --omit-header
1. Update translations of existing languages or add new languages
1. Update translations of existing languages by running this command for each locale:
pybabel update -l es_ES -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete
Run this command for each locale by replacing es_ES in the command. Locale names are the directory names in ./locale.
1. Add new languages
Run this command for each new language to add. You will need to replace es_ES in the command with the locale code to add:
pybabel init -l es_ES -d ./locale -i ./locale/messages.pot
Add the locale to the locales array in config.py. Instructions on how to pick a locale code are provided in the comments above the array.
1. Provide translations for each language
In each locale//LC_MESSAGES directory there is a file messages.po. Users translate the strings in these files.
msgid is the text in English. msgstr is the translation to the language indicated by the locale code. For example:
+ msgid "Change your password"
+ msgstr "Cambiar tu contraseña"
1. Compile translations
Run: pybabel compile -f -d ./locale
See webapp2's tutorial and pybabel's docs for more details.
Disabling i18n i18n can be disabled and language options hidden. Set locales in config.py to None or empty array [] to do this. This may be useful to provide a performance boost or simplify sites that serve a market with only one language. The locale directory can be safely removed to save space if not needed but the babel and pytz directories cannot be removed without breaking code (imports and trans statements) at this time.
SSL + SSL is enabled site wide by adding secure: always to the section: - url: /. in app.yaml (remove this line to disable) + SSL either requires a free google app engine .appspot.com domain or a custom domain and certificate + Alternatively SSL can be enabled at a controller level via webapp2 schemes. Use the secure_scheme provided in routes.py + It is recommended to enable ssl site wide to help prevent session hijacking
Passwords + Passwords are hashed and encrypted with SHA512 and PyCrypto.
CSRF + Cross-site request forgery protection
Google App Engine Boilerplate is a collaborative project created by coto which is bringing to you thanks to the help of these amazing people
Top 10: Primary contributors: + Tmeryu + Peta15 + Sergue1 + Sabirmostofa + Pmanacas + copycat91 + Mooose + f1shear + presveva + Sorced-Jim
$ claude mcp add gae-boilerplate \
-- python -m otcore.mcp_server <graph>