tips:pyramid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tips:pyramid [2015/05/28 09:35] – [Environment] scipiotips:pyramid [2015/08/18 12:32] (current) – [yml] scipio
Line 1: Line 1:
 ====== Pyramid ====== ====== Pyramid ======
  
-===== Environment =====+===== classic ===== 
 + 
 +==== Environment ====
  
 library library
Line 33: Line 35:
 <code> <code>
 pserve development.ini --reload pserve development.ini --reload
 +</code>
 +
 +===== bower =====
 +
 +Bower can help to install javascript client side libraries, like angularjs.
 +
 +Install npm and bower at system level
 +<code>
 +sudo apt-get install npm
 +sudo npm install -g bower
 +</code>
 +
 +Install module (library)
 +<code>
 +# cd <project>/<same-level-of-subdir-static>
 +bower install angular-bootstrap
 +</code>
 +
 +Libraries:
 +  * angular  
 +  * angular-bootstrap  
 +  * angular-wamp  
 +  * autobahn  
 +  * bootstrap  
 +  * jquery  
 +  * leafelet-bouncemarker  
 +  * leaflet  
 +  * Leaflet.label
 +
 +In __init__.py
 +<code>
 +config.add_static_view('bower_components', 'bower_components', cache_max_age=3600)
 +</code>
 +
 +In template 
 +<code html>
 +<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>
 +</code>
 +===== aio =====
 +
 +library
 +<code>
 +BASE=/lab/ztl
 +cd $BASE
 +
 +virtualenv lib
 +. lib/bin/activate
 +pip install aiopyramid
 +</code>
 +library activation in active shell (for starting project and running)
 +<code>
 +. lib/bin/activate
 +</code>
 +
 +start project **ztlbrain**
 +<code>
 +pcreate --scaffold aio_websocket ztlbrain
 +cd ztlbrain
 +python setup.py develop
 +</code>
 +
 +initialize db
 +<code>
 +initialize_ztlbrain_db development.ini
 +</code>
 +
 +run
 +<code>
 +gunicorn --paste development.ini
 +</code>
 +
 +===== yaml =====
 +
 +Use yaml file as configuration container. See [[http://tzfpyramid-yml.readthedocs.org/en/latest/usage.html|here]]
 +
 +setup.py
 +<code>
 +requires = [
 +...
 +   'tzf.pyramid_yml'
 +....
 +</code>
 +
 +__init__.py
 +<code>
 +config.include('tzf.pyramid_yml')
 +</code>
 +
 +
 +*ini
 +<code>
 +yaml.location =  /lab/wega/wegasim
 +env = dev
 +</code>
 +
 +config.yml
 +<code>
 +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'
 </code> </code>
  
  • tips/pyramid.1432798511.txt.gz
  • Last modified: 2015/05/28 09:35
  • by scipio