【问题标题】:Pyramid + github + pip: install problemsPyramid + github + pip:安装问题
【发布时间】:2013-05-19 17:55:18
【问题描述】:

我需要从 github 的私人仓库安装 Pyramid 项目。

该项目的结构如下:

项目名 项目名 楷模/ 意见/ 模板/ __init__.py 安装程序.py

我执行git clone,然后执行pip install project_name 以将其从本地存储库安装到virtualenv

然后我用pserve production.ini 启动服务器,它启动没有问题。

但是,我在定位 mako 模板时遇到问题...

我得到错误:

TopLevelLookupException: Cant locate template for uri for `home.mak`

另外,我注意到在安装我的项目的site_packages 内,除了templates/ 目录之外的所有文件都被复制。为什么会这样?

在我的production.ini 中,我有指令...

mako.directories = my_project:templates

在我的视图函数中,我正在做这样的事情:

@view_config(route_name='home', renderer="home.mak")
def home_view(req):
    ...

为什么会出现这个错误?

更新

当我手动将templates 文件夹复制到env/lib/python3.2/site-packages/my_pproject/ 时——一切正常。

因此,我的问题是:为什么在我安装软件包时没有复制 templates 目录?

【问题讨论】:

  • 问题已解决:我丢失了 MANIFEST.in 文件。

标签: python-3.x pyramid mako


【解决方案1】:

我需要添加 MANIFEST.in 文件,这在您需要将非 python 文件添加到安装时很重要。

【讨论】:

    猜你喜欢
    • 2020-07-25
    • 2017-12-16
    • 1970-01-01
    • 1970-01-01
    • 2012-02-12
    • 2017-06-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-22
    相关资源
    最近更新 更多