Skip to main content

The handy environment for developing GAE applications.

Project description

## ****Laconic MVC****
### A distributive for fast deployment on Google App Engine.
-----

### **Benefits:**
[Laconic MVC](http://laconic-mvc.appspot.com/) - the handy environment for developing GAE applications.

* This boilerplate contains best python libraries for web development.
* GaeDataManager - upload manager for datastore.
* BottleGaeWrapper - wrapper around beaker, appengine users sevice, mako templates.


GaeDataManager can serve as great starting pattern for BackboneJS (CoffeeScript) ifaces.
##### [Example](http://laconic-mvc.appspot.com/files/)
##### [file-manager.coffee](https://bitbucket.org/nesforge/laconic/raw/ebb4ef0ae81cad8d6e07bbf52f9303fad6043b1f/app/view/assets/file-manager.coffee)
----
###***How to:***
##### ***Create controller:***
###### ./app/index.py
```python

from config import app
from model.index import Model

@app.get('/')
def index(wrap): #wrap is wrapper for gae


data_query = Model.all()

wrap.page_number = request.query.get('page')
wrap.page_size = request.query.get('size')

wrap.paginate(data_query)

return wrap.render('index.haml', key = value, name = 'world', **{})

```
-----

##### ***Create view***:

###### ./app/view/index.haml:
```HAML
%%inherrit(file="layout.haml")

%div.panel.row

-if name:

Hello ${name}!!

-for i in name:
${i}

%%include(file="file.haml")

```

----

##### ***Write in session***:

```python
wrap.set(counter=0)
wrap.get('counter')
wrap.clean() #clean session data
```

----

##### ***Get user info***:

```python
wrap.user()
wrap.nickname()
wrap.email()
wrap.user_id()
```

----

##### ***Call Login / Logout actions***:

Simply, a http query string must contain 'login' or 'logout' in order to call login/logout actions.

```python
wrap.login()#.logout()
```

----

##### ***Check permissions:***

Write your own permission control methods in ./dist/handlers.py. (engine class)
There are two methods by default.

```python
wrap.admin()
wrap.permission('admin')
```

----

##### ***Run unit tests:***

There are who runners - the first one for datastore models, another for controllers.

###### ***Test datastore models:***
To test your model create test file in model directory (example: ./app/model/test_example.py),
and run 'db_tests.py' with path to google app engine as first argument:
```sh
python db_tests.py /path/to/google_app_engine
```

###### ***Test controllers***
To test your controllers write your callbacks and requests in test_app.py ,
and run with path to google app engine as first argument:

```sh
python test_app.py /path/to/google_app_engine
```

##### ***Develop frontend***

All frontent libraries live in './app/view/static/' ,
CoffeeScript and SCSS files placed in './app/view/assets/' .
In order to compile assets directory - run ./app/view/build.sh.
<br/>
```sh
sh ./app/view/build.sh
```

You can bind this command to your lovely editor or IDE.


----
#### ***This distributive includes:***
* GaeDataManager - Upload manager for Google datastore.
* BottleGaeWrapper - GAE utils for bottle.
* PyHaml - HAML syntax for Mako.
* CoffeeScript - Best syntax sugar for javascript.
* Foundation5 - Responsive CSS framework.
* BackboneJS / Jquery.
* Bottle.py - WSGI microframework.
* Mako - Python template engine.
* Markdown - Markdown for python.
* WTForms - Web form renderer.
* Beaker - Session midleware
* GAE mini profiler - app engine profiler
* Beautiful Soup 4 - Python html parser.
* WebTest - WSGI test runner
-----

(c) Anton A Nesterov 2014
LICENSE: Apache2.0

Project details


Release history Release notifications | RSS feed

This version

1.0

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page