skip to navigation
skip to content

Laconic-MVC 1.0

The handy environment for developing GAE applications.

## ****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.


```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  
  • Author: Anton A Nesterov
  • Bug Tracker: https://bitbucket.org/nesforge/laconic/
  • Download URL: https://bitbucket.org/nesforge/laconic/downloads
  • Keywords: GAE, google, bottle, webtest, mvc
  • License:
    Copyright 2014 Anton A Nesterov
    
       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at
    
           http://www.apache.org/licenses/LICENSE-2.0
    
       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
  • Platform: Google App Engine
  • Requires GAE
  • Categories
  • Package Index Owner: Anton.Nesterov
  • DOAP record: Laconic-MVC-1.0.xml