Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tips:pyramid [2015/05/28 09:27] – created scipio | tips:pyramid [2015/08/18 12:32] (current) – [yml] scipio | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Pyramid ====== | ====== Pyramid ====== | ||
+ | |||
+ | ===== classic ===== | ||
+ | |||
+ | ==== Environment ==== | ||
library | library | ||
Line 9: | Line 13: | ||
. lib/ | . lib/ | ||
pip install pyramid | pip install pyramid | ||
+ | </ | ||
+ | |||
+ | library activation in active shell (for starting project and running) | ||
+ | < | ||
+ | . lib/ | ||
</ | </ | ||
Line 18: | Line 27: | ||
</ | </ | ||
+ | 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 < | ||
+ | bower install angular-bootstrap | ||
+ | </ | ||
+ | |||
+ | Libraries: | ||
+ | * angular | ||
+ | * angular-bootstrap | ||
+ | * angular-wamp | ||
+ | * autobahn | ||
+ | * bootstrap | ||
+ | * jquery | ||
+ | * leafelet-bouncemarker | ||
+ | * leaflet | ||
+ | * Leaflet.label | ||
+ | |||
+ | In __init__.py | ||
+ | < | ||
+ | config.add_static_view(' | ||
+ | </ | ||
+ | |||
+ | In template | ||
+ | <code html> | ||
+ | <link href=" | ||
+ | <script src=" | ||
+ | <script src=" | ||
+ | <script src=" | ||
+ | </ | ||
+ | ===== aio ===== | ||
+ | |||
+ | library | ||
+ | < | ||
+ | BASE=/ | ||
+ | cd $BASE | ||
+ | |||
+ | virtualenv lib | ||
+ | . lib/ | ||
+ | pip install aiopyramid | ||
+ | </ | ||
+ | library activation in active shell (for starting project and running) | ||
+ | < | ||
+ | . lib/ | ||
+ | </ | ||
+ | |||
+ | 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 [[http:// | ||
+ | |||
+ | setup.py | ||
+ | < | ||
+ | requires = [ | ||
+ | ... | ||
+ | ' | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | __init__.py | ||
+ | < | ||
+ | config.include(' | ||
+ | </ | ||
+ | |||
+ | |||
+ | *ini | ||
+ | < | ||
+ | yaml.location = / | ||
+ | env = dev | ||
+ | </ | ||
+ | |||
+ | config.yml | ||
+ | < | ||
+ | configurator: | ||
+ | serial_code : ' | ||
+ | serial.port : '/ | ||
+ | serial.speed : 9600 | ||
+ | test.serial.port : '/ | ||
+ | test.serial.speed : 9600 | ||
+ | wamp.router.url : ' | ||
+ | wamp.router.push : ' | ||
+ | wamp.realm : ' | ||
+ | </ | ||