我正在尝试将我正在编写的 Python 金字塔应用程序从一台服务器移动到另一台服务器。我从源代码管理中检查了代码并运行 apython setup.py develop
来准备环境,但是当我尝试运行时,pserve development.ini
我得到以下回溯:
2013-02-27 20:38:20,269 INFO [pyramid_scss][MainThread] adding asset path /home/pgrace/repos/Asterisk-WebApps/Cedar-Root/opt/cedar/cedar/assets/scss
Traceback (most recent call last):
File "/home/pgrace/venvs/pyramid/bin/pserve", line 8, in <module>
load_entry_point('pyramid==1.4', 'console_scripts', 'pserve')()
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/pyramid/scripts/pserve.py", line 50, in main
return command.run()
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/pyramid/scripts/pserve.py", line 304, in run
global_conf=vars)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/pyramid/scripts/pserve.py", line 328, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(*args, **kw)
File "/home/pgrace/repos/Asterisk-WebApps/Cedar-Root/opt/cedar/cedar/__init__.py", line 18, in main
config.include("pyramid_scss")
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/pyramid/config/__init__.py", line 773, in include
c(configurator)
File "/home/pgrace/venvs/pyramid/lib/python2.6/site-packages/pyramid_scss/__init__.py", line 88, in includeme
scss.LOAD_PATHS = ','.join([scss.LOAD_PATHS, ','.join(load_paths)])
AttributeError: 'module' object has no attribute 'LOAD_PATHS'
现在,我可以说问题出在 pyramid_scss,但据我所知,它引用的代码很好,就好像module
该类不包含 LOAD_PATHS 指令一样。我试图弄清楚它指的是哪个模块,以便我可以追踪我是否缺少依赖项或其他东西。有谁知道我将如何确定module
参考指向的位置,以便我可以检查该代码?
编辑:错误出现在includeme
定义中,每当一个特定于金字塔的包被实例化时,它就会自动包含在我读过的内容中?也许?无论如何,它说 scss.LOAD_PATHS 不存在,是的,但是在任何一个pyramid_scss
或pyScss
包中都没有 scss 类,这让我想知道是否还有其他一些正在后期绑定的类。
def includeme(config):
load_paths, static_path = _get_import_paths(config.registry.settings)
scss.LOAD_PATHS = ','.join([scss.LOAD_PATHS, ','.join(load_paths)])
scss.STATIC_ROOT = static_path
config.add_renderer('scss', renderer_factory)
pyScss 中的Scss
类确实包含一个 LOAD_PATHS 指令,但我看不到对象 scss 绑定到 Scss 类定义的位置。我想知道def includeme
上面是否缺少一些可能是答案的一部分,但随后它引出了一个问题——这在另一台机器上工作正常,为什么现在中断?还有一些东西我只是没有接受。