Now we'll add more technical details about:
- how to install pyramid_starter_seed and its prerequisites
How to install pyramid_starter_seed
Prerequisites
As you can imagine, nodejs tools are required.I strongly suggest to:
- avoid system packages because they are too old
- install nodejs with nvm (Node Version Manager)
The nvm achronym stands for NodeJS Version Manager. Once installed nvm, installing nodejs it is as simple as typing nvm install VERSION (at this time of writing 0.10.32).
Nodejs is shipped with the command line utility named npm (Nodejs Package Manager) and we will use npm for installing what we need.
We need to install our global (-g option) dev dependencies, so just type:
$ npm install -g bower
$ npm install -g grunt-cli
$ npm install -g karma
Starter seed project installation
Create an isolated Python environment as explained in the official Pyramid documentation and instal Pyramid.Once installed you can clone pyramid_starter_seed from github:
$ git clone git@github.com:davidemoro/pyramid_starter_seed.gitNot finished yet, continue.
$ cd pyramid_starter_seed
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/python setup.py develop
Yeoman initialization
Go to the folder where it lives our Yeoman project and initialize it.These are the standard commands (but, wait a moment, see the "Notes and known issues" subsection):
$ cd pyramid_starter_seed/webappKnown issues:
$ bower install
$ npm install --loglevel verbose
- if you are behind a proxy you'll have to configure properly npm
- if you have a slow internet connection you might experience timeout problems.
Build phase
Just type:$ gruntand... probably it will fail because of a couple of known issues shipped with the latest version of generator-webapp or its dependencies.
Probably these issues will be fixed in newer generator-webapp releases. However here it is how to solve these problems, so don't worry:
- grunt-contrib-imagemin fix
Problem with grunt:Warning: Running "imagemin:dist" (imagemin) task
Solution:
Warning: Bad argument Use --force to continue.$ npm cache clean
$ rm -fR node_modules # not sure it is needed, don't remember
$ npm install grunt-contrib-imagemin - Mocha/PhantomJS issue
Problem with Mocha/PhantomJS launching grunt
Warning: PhantomJS timed out, possibly due to a missing Mocha run() call. Use --force to continue.Solution:
$ cd testRun bower install in the test directory of webapp (pyramid_starter_seed/webapp/test). This is a known issue, see https://github.com/yeoman/generator-webapp/issues/446.
$ bower install
Run you Pyramid app
Now can choose to run Pyramid in development or production mode.Just type:
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/pserve development.inior:
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/pserve production.iniDone!
In the next blog post with topic Pyramid + Yeoman (coming soon) I'm going to talk about:
- how to manage things with grunt and personalize pyramid_starter_seed registering other assets
- how to clone pyramid_starter_seed. Yes, you can easily customize it creating something of more sophisticated and create your own starter seed with another name. Without having to write a package generator
Links
- pyramid_starter_seed (github repo): https://github.com/davidemoro/pyramid_starter_seed
- part 1 (benefits of yeoman fully integrated with a web framework like Pyramid): http://davidemoro.blogspot.com/2014/09/pyramid-starter-seed-yeomam-part-1.html
- part 2 (how to install pyramid_starter_seed ant its prerequisites, this blog post) - http://davidemoro.blogspot.com/2014/09/pyramid-starter-seed-yeoman-part-2.html
- part 3 (how to manage things with grunt, personalize pyramid_starter_seed and create your own starter template) - http://davidemoro.blogspot.com/2014/09/pyramid-starter-seed-yeoman-part-3.html
No comments:
Post a Comment
Note: only a member of this blog may post a comment.