Template loading from wrong directory -- Don't see how this is even possible.

14 views
Skip to first unread message

pkraus

unread,
Sep 13, 2011, 4:34:47 PM9/13/11
to turbo...@googlegroups.com

I am really confused i have a directory structure as follows. /foo/bar/project/

under project is the python environment via virtualenv.

I have two additional folders live, and beta both git repositories.

Live is served via apache wsgi and beta is served using paster.

Some how the live site is serving templates from the beta directory. To make sure i wasn't losing my mind I renamed the beta directory to wtfbeta expecting the server to throw an error helping me track down what went wrong.

Nope, instead it just falls back to loading the correct template from the live directory. (after service apache2 restart).

I am really stuck here. I was expecting errors when i renamed the folder how it could without incident just fallback to the correct template and folder BLOWS MY MIND.

Tony Sullivan

unread,
Sep 13, 2011, 5:10:53 PM9/13/11
to turbo...@googlegroups.com
Hi Paul,

I'm not exactly sure if what you are referring to Turbogears finding and rendering templates, or just serving static files from different directories.  If your issue is about serving static files, PasteCascade, the outer-most wsgi layer is likely involved.  You can read more about it here: http://turbogears.org/2.1/docs/main/RequestFlow.html.

At this point I'm just taking a guess based on what you reported.  If I haven't answered your question sufficiently please provide more detail.

Tony



--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To view this discussion on the web visit https://groups.google.com/d/msg/turbogears/-/qzaDP7kNYQAJ.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

pkraus

unread,
Sep 13, 2011, 7:06:54 PM9/13/11
to turbo...@googlegroups.com
No these are not static files but server files. It's bizarre.

pkraus

unread,
Sep 13, 2011, 7:42:54 PM9/13/11
to turbo...@googlegroups.com
I am really getting twisted around the axel. Here is the run down on the events leading up to this.

I have all my tg projects in /usr/local/turbogears
each project has two folders <project>_beta|live. So in order to clean things up i decided that I wanted the following setup..

/usr/local/turbogears/<project name>
then under this folder i wanted it to contain the virtual env for the project and to put the live and beta folders in this "master folder".

Since i was doing the move i figured i would also update from 2.0 to 2.1.1 so i started with a fresh 2.1.1 virtual env then updated the code for the changes.

"live" is served via apache 2 using wsgi.
"beta" is served via paster.

I make changes in beta and then using git push them to live.

With paster not running on beta the live site is pulling up the templates in the beta folder. If I rename the beta folder to something else then tg servers the correct templates from the live folders. These are the templates in /project/templates.

I think this has something to do with wsgi and some cache folder or something, i don't know. I am just really getting annoyed.

Thanks,
PK

pkraus

unread,
Sep 13, 2011, 9:29:33 PM9/13/11
to turbo...@googlegroups.com
I just put everything back to separate root directories.

Michael Pedersen

unread,
Sep 13, 2011, 11:30:54 PM9/13/11
to turbo...@googlegroups.com
I'm sorry I took so long to reply. I think, though, that I see your problem.

You've made it sound like you are using a directory structure like this:

/usr/local/turbogears/project_venv
/usr/local/turbogears/project_live
/usr/local/turbogears/project_beta

Furthermore, you've got _live and _beta installed into the same virtualenv. Finally, even though _live and _beta are separate directories, their setup.py identifies them with the same project name.

If that's correct, then it simply won't work properly (and if you have something similar that does, then it's a complete fluke, and should not be relied upon).

What's going on is that the system is looking for a template named (for example) project.templates.foo.bar

However, you have two versions of the project living inside the wsgi virtual environment. This results in, at best, unpredictable results. The correct fix would be to do something like this:

/usr/local/turbogears/project_venv_live
/usr/local/turbogears/project_live
/usr/local/turbogears/project_venv_beta
/usr/local/turbogears/project_beta

Installed project_beta into its own virtualenv, project_live into its own. Your problems will go away entirely.

On Tue, Sep 13, 2011 at 9:29 PM, pkraus <paul....@gmail.com> wrote:
I just put everything back to separate root directories.

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To view this discussion on the web visit https://groups.google.com/d/msg/turbogears/-/Skk5Spit6SIJ.

To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.



--
Michael J. Pedersen
My IM IDs: Jabber/pede...@icelus.tzo.com, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/pederm...@hotmail.com
My Online Resume: http://www.icelus.org/
Twitter: pedersentg

Reply all
Reply to author
Forward
0 new messages