Search code examples
pythonpyramid

Pyramid directory structure confusion


I have a pyramid project with the following directory structure. Inside my views.py, I have this line of code that specifies where my template is.

@view_config(route_name='home', renderer='templates/mytemp.pt')

Now, I get an error since it is looking for my template inside my view directory. Even if I give the path as "demo/templates/mytemp.pt" I get the same error.

ValueError: Missing template asset: demo.view:templates/mytemp.pt (/home/Demo/demo/view/templates/mytemp.pt)

This is my directory structure:-

   Demo/
    |-- Demo.egg-info
    `-- demo
        |-- errors
        |-- model
        |-- scripts
        |-- static
        |   `-- somefolder
        |-- templates
        |-- test
        `-- view

My views.py is inside the view folder and mytem.pt sits inside templates folder.Any help appreciated. Thanks.


Solution

  • Appending ../ to the beginning of the renderer argument seems to work. :)