#Flask on Google App Engine Template
Kelp https://twitter.com/kelp404
[MIT License][mit]
[MIT]: http://www.opensource.org/licenses/mit-license.php
______ __ ______ ______ __ __
/\ ___\ /\ \ /\ __ \ /\ ___\ /\ \/ /
\ \ __\ \ \ \____ \ \ __ \ \ \___ \ \ \ _"-.
\ \_\ \ \_____\ \ \_\ \_\ \/\_____\ \ \_\ \_\
\/_/ \/_____/ \/_/\/_/ \/_____/ \/_/\/_/
This project is my GAE project template.
And the example application uses History to link pages, so that all hyperlinks are ajax.
##Frameworks
- Flask 0.9 Mar 31, 2013 @6309987
- Jinja 2.6 Apr 12, 2013 @846bdc1
- Werkzeug 0.8.3 Apr 17, 2013 @0ef8613
- Bootstrap 2.3.1
- jQuery 2.0.0
- Google App Engine Launcher 1.7.7
##How to use?
git clone --recursive git://github.com/kelp404/Flask-GAE.git
./
├─ application # Web application code
├─ flask # Flask framework
├─ gae_mini_profiler # GAE mini profiler
├─ jinja2 # Jinja framework
├─ tests # Unit tests
├─ werkzeug # Werkzeug framework
├─ app.yaml # GAE app config
├─ backends.yaml # GAE backends config
├─ config.py # Application config
├─ cron_jobs.py # Cron jobs code
├─ cron.yaml # GAE Cron jobs config
└─ index.yaml # GAE datasotre indexes config
./application/
├─ data_models # Datastore data model
├─ handlers # Web handlers (MVC's controller)
├─ models # Other models
├─ services # All business logic here (MVC's model)
├─ static
│ ├─ coffees # CoffeeScript
│ ├─ css
│ ├─ icon
│ ├─ imgs
│ ├─ javascripts
│ ├─ jc # JavaScript compiler
│ └─ robots.txt
├─ templates # Jinja templates (MVC's view)
├─ utilities # Web application's shared utilities(helpers)
├─ __init__.py
└─ routes.py # Web application's routers
##Example application
Board: https://flask-gae-kelp.appspot.com/posts
Chat: https://flask-gae-kelp.appspot.com/chat
##Deploy with appcfg.py
You should create a GAE account.
https://appengine.google.com
###update app.yaml
application: flask-gae-kelp
'flask-gae-kelp' should replace to your Application Identifier.
###deploy project deploy
appcfg.py update Flask-GAE/
* Flask-GAE is the folder name of the project
deploy backends
appcfg.py backends Flask-GAE/ update
###deleting unused indexes
appcfg.py vacuum_indexes myapp/
# https://developers.google.com/appengine/docs/python/tools/uploadinganapp?hl=en#Deleting_Unused_Indexes
##CoffeeScript compile & JavaScript minify You should install node.js and coffee-script.
$ cd Flask-GAE/applicatioin/static
$ python jc
##Unittest Before test, you should run GAE local server, and clear datastore, text search, and update url in function 'setUp()'.
class TestFunctions(unittest.TestCase):
def setUp(self):
self.url = 'http://localhost:8081'
self.email = 'kelp@phate.org'
self.cookies = { 'dev_appserver_login': "kelp@phate.org:True:111325016121394242422" }
clear datastore & text search:
--clear_datastore=yes --clear_search_indexes=yes
$ cd Flask-GAE
$ python tests
Python unit test reference: http://docs.python.org/2/library/unittest.html
##References
- Google App Engine SDK
- Google App Engine Python Overview
- Flask on GitHub (document)
- Jinja2 on GitHub (document)
- Werkzeug on GitHub (document)
- itsdangerous on GitHub
- Bootstrap
- CoffeeScript on GitHub (document)
- jQuery
- Google App Engine Mini Profiler on GitHub
- SlimIt on GitHub
- Requests on GitHub
- Beautiful Soup