当我尝试运行金字塔时
[~/env/MyStore]# ../bin/pserve development.ini
它将显示以下错误
File "/home/vretinfo/env/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste/fileapp.py", line 14, in <module>
from paste.httpheaders import *
File "/home/vretinfo/env/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste/httpheaders.py", line 140, in <module>
from rfc822 import formatdate, parsedate_tz, mktime_tz
ImportError: No module named rfc822
我该如何解决这个问题?
这就是我安装
的方法$ mkdir opt
$ cd opt
$ wget http://python.org/ftp/python/3.2.3/Python-3.2.3.tgz
$ tar -xzf Python-3.2.3.tgz
$ cd Python-3.2.3
./ configure --prefix = $ HOME / opt / Python-3.2.3
$ make;
$ make install
$ cd ~
$ wget http://python-distribute.org/distribute_setup.py
$ pico distribute_setup.py
* change first line to opt/Python-3.2.3/python
$ opt/Python-3.2.3/bin/python3.2 distribute_setup.py
$ opt/Python-3.2.3/bin/easy_install virtualenv
$ opt/Python-3.2.3/bin/virtualenv --no-site-packages env
$ cd env
$ ./bin/pip install passlib
$ ./bin/pip install pyramid_beaker
$ ./bin/pip install pyramid_mailer
$ ./bin/pip install pyramid_mongodb
$ ./bin/pip install pyramid_jinja2
$ ./bin/pip install Werkzeug
$ ./bin/pip install pyramid
$ ./bin/pcreate -s pyramid_mongodb MyShop
$ cd MyShop
$ ../bin/python setup.py develop
$ ../bin/python setup.py test -q
好的,我已经在金字塔文档(http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/paste.html)上进行了一些搜索。 它在第3段陈述
“但是,所有Pyramid脚手架都会呈现PasteDeploy配置文件,为新开发人员提供设置部署值的标准化方法,并为新用户提供启动,停止和调试应用程序的标准化方法。”
所以我对development.ini进行了更改并替换了
[server:main]
use = egg:waitress#main
在setup.py中,我将'waitress'添加到requires数组
下一步,我在/ home / vretinfo / env / ECommerce /中完成了删除与Paste相关的所有事情,
$ rm -rf Paste*;rm -rf paste*
在此之后,我再次尝试运行test -q,这是堆栈跟踪:
[~/env/ECommerce]# ../bin/python setup.py test -q
/home/vretinfo/opt/Python-3.2.3/lib/python3.2/distutils/dist.py:257: UserWarning: Unknown distribution option: 'paster_plugins'
warnings.warn(msg)
running test
Checking .pth file support in .
/home/vretinfo/env/ECommerce/../bin/python -E -c pass
Searching for Paste>=1.7.1
Reading http://pypi.python.org/simple/Paste/
Reading http://pythonpaste.org
Best match: Paste 1.7.5.1
Downloading http://pypi.python.org/packages/source/P/Paste/Paste-1.7.5.1.tar.gz#md5=7ea5fabed7dca48eb46dc613c4b6c4ed
Processing Paste-1.7.5.1.tar.gz
Writing /tmp/easy_install-q5h5rn/Paste-1.7.5.1/setup.cfg
Running Paste-1.7.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-q5h5rn/Paste-1.7.5.1/egg-dist-tmp-e3nvmj
warning: no previously-included files matching '*' found under directory 'docs/_build/_sources'
由于某种原因,pyramid1.4似乎需要粘贴。也许有人对此有一些见解。
答案 0 :(得分:0)
我已经设法通过IRC #pyramid中的人解决了这个问题。我在这里发布解决方案以防将来有人遇到。我已经在Python3.2中对此进行了测试,现在工作正常。
运行./bin/pcreate -s&lt; ...&gt;
在项目的文件夹中,development.ini
更改以下内容:
1. in the 1st line, rename [app:<Project>] to [app:main]
2. [server:main]
If it is egg:Paste#http, change it to
use = egg:waitress#main
3. remove [pipeline:main] and its section
在同一文件夹中,对setup.py进行必要的更改:
1. requires = [....], add in waitress into the array, remove WebError from the array
2. remove paster_plugins=['pyramid']
最后,运行
$ ../bin/python setup.py develop
如果存在,则不会安装或检查粘贴。