Saturday, January 21, 2006

Template Changed...

Hi Wilson, Thanks for the advice. I have tried to put in the "filesystem path to whatever directory you choose", in the TEMPLATE_DIRS.

And After a few tried, I manage to change the template. But notice one thing though,
say that when I put mytemplate at the path as below,



So I would put into the TEMPLATE_DIRS some path like this,

TEMPLATE_DIRS = (
"C:\Python24\Django-0.91\django\bin\myproject\mytemplates",
)


That didn't work.

So now I try to move mytemplates folder to another directory, like this,


And then modified the settings.py accordingly as below,

TEMPLATE_DIRS = (
"C:\Python24\Django-0.91\mytemplates",
)


Voila! It works now, the default website name and URL change to what I want. But the problem is, I can't see any different between this two setting, except they pointing to different folder.

As what I understand, the templates can go anywhere we want, as long as the TEMPLATE_DIRS setting does include the filesystem path to whatever directory we choose, it should work. But this really not the case. Is it due to the parameter being too long? or it couldn't actually refer to template within some folder?

5 comments:

Yannick said...

Hey kahfei,

I just realised you are a big python fan. That's pretty cool. I don't have any experience with it, but recently have been kinda reading up on Django out of curiousity. Well that and Ruby on Rails. Anyway keep up the good work and also looking forward to seeing more of the news stories you post about on Newsvine.

Take care.

kahfei said...

Hey Yannick,

A pleasant surprise to see your comment here! Welcome and

Hmmm... I am a big fan of Python, but that said, the only other language that I know is ASP and VB, and maybe a bit of Java. So, I am really learning both Python and Django.. Hopefully I could develop something out of it.

Yannick said...

Well I wish you all the best. I know you'll develop something soon and it'll be good.

likwoka said...

kahfei, the problem is that in path "C:\Python24\Django-0.91\django\bin\myproject\mytemplates", there is a "\b" which is escaped to something else.

Use r"C:\Python24\Django-0.91\django\bin\myproject\mytemplates" or change all the backslash to forwardslash (as the comments in settings.py said) would work.

kahfei said...

Hi likwoka,

Thanks for the info, appreciate that. Will try it.

Care to leave your blog address, so I could drop by too? :-)