先决条件¶
If you want to play with pyramid_starter_seed 您需要安装 NodeJS and, obviously, Python. Once installed Python and Pyramid, you'll have to clone the pyramid_starter_seed repository from github and initialize the Yeoman stuff.
Python and Pyramid¶
用python 2.7测试了 pyramid_starter_seed
种子。创建一个独立的python环境,如官方 Pyramid 文档中所述,然后安装 Pyramid 。
Official Pyramid installation documentation
NodeJS¶
在代码中根本不使用nodejs,只需要安装yeoman工具所需的开发依赖项。
Once installed NodeJS (if you want to easily install different versions on your system and manage them you can use the NodeJS Version Manager utility: NVM ), you need to enable the following tools:
$ npm install -g bower
$ npm install -g grunt-cli
$ npm install -g karma
Tested with NodeJS version 0.10.31.
How to install pyramid_starter_seed¶
克隆 pyramid_starter_seed 从GITHUB:
$ git clone git@github.com:davidemoro/pyramid_starter_seed.git
$ cd pyramid_starter_seed
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/python setup.py develop
约曼初始化¶
转到它所在的文件夹,并初始化它。
这些是标准命令(但请稍等,请参阅“说明和已知问题”小节):
$ cd pyramid_starter_seed/webapp
$ bower install
$ npm install
已知问题¶
为了获得一个工作环境,您需要执行这些额外的步骤(Pyramid启动程序种子使用的生成器webapp版本有几个已知问题)。
Avoid imagemin errors on build:
$ npm cache clean
$ npm install grunt-contrib-imagemin
Avoid Mocha/PhantomJS issue (see issues #446 ):
$ cd test
$ bower install
构建¶
运行:
$ grunt build
Run pyramid_starter_seed¶
现在可以选择在开发或生产模式下运行 Pyramid 。
转到项目目录的根目录,其中的文件 development.ini 和 production.ini 位于。
cd ../../..
只是类型:
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/pserve development.ini
或:
$ YOUR_VIRTUALENV_PYTHON_PATH/bin/pserve production.ini