Table of Contents

Pyramid

classic

Environment

library

BASE=/lab/ztl
cd $BASE

virtualenv lib
. lib/bin/activate
pip install pyramid

library activation in active shell (for starting project and running)

. lib/bin/activate

start project ztlbrain

pcreate --scaffold alchemy ztlbrain
cd ztlbrain
python setup.py develop

initialize db

initialize_ztlbrain_db development.ini

run

pserve development.ini --reload

bower

Bower can help to install javascript client side libraries, like angularjs.

Install npm and bower at system level

sudo apt-get install npm
sudo npm install -g bower

Install module (library)

# cd <project>/<same-level-of-subdir-static>
bower install angular-bootstrap

Libraries:

In init.py

config.add_static_view('bower_components', 'bower_components', cache_max_age=3600)

In template

<link href="${request.static_url('ztlbrain:bower_components/bootstrap/dist/css/bootstrap.min.css')}" rel="stylesheet">
<script src="${request.static_url('ztlbrain:bower_components/jquery/dist/jquery.min.js')}"></script>
<script src="${request.static_url('ztlbrain:bower_components/angular/angular.min.js')}"></script>
<script src="${request.static_url('ztlbrain:bower_components/angular-bootstrap/ui-bootstrap.min.js')}"></script>

aio

library

BASE=/lab/ztl
cd $BASE

virtualenv lib
. lib/bin/activate
pip install aiopyramid

library activation in active shell (for starting project and running)

. lib/bin/activate

start project ztlbrain

pcreate --scaffold aio_websocket ztlbrain
cd ztlbrain
python setup.py develop

initialize db

initialize_ztlbrain_db development.ini

run

gunicorn --paste development.ini

yaml

Use yaml file as configuration container. See here

setup.py

requires = [
...
   'tzf.pyramid_yml'
....

init.py

config.include('tzf.pyramid_yml')

*ini

yaml.location =  /lab/wega/wegasim
env = dev

config.yml

configurator:
    serial_code : 'ABCD'
    serial.port : '/dev/ttyUSB3'
    serial.speed : 9600
    test.serial.port : '/dev/ttyUSB2'
    test.serial.speed : 9600
    wamp.router.url : 'ws://localhost:6001/ws'
    wamp.router.push : 'http://localhost:6001/push'
    wamp.realm : 'realm_sim'