librelist archives

« back to archive

Problem with directory names

Problem with directory names

From:
Mmn
Date:
2013-06-01 @ 15:26
Hello,

I am facing a weird problem with directory names for templates. I am having
my default templates folder as templates folder. I have two blueprints
order_blueprint with url of /order and customer_blueprint with url of
/customer. My template fiiles for order and customer are under templates
under directory names of order and customer respectively. I have some
utility templates which I kept them under order/util and customer/util.
However it so happened that one file had the same name under util
directories in order as well as customer. So from my order_blueprint when I
do return render_template('util/filename.html'), it was getting it from
customer directory as that is above in alphabetical order.

I got rid of the problem by renaming the directory to order_util. It looks
like whatever I was doing was correct from the documentation. Can some one
please tell me if I am doing something wrong?

Regards,
MMN
-- 
--
It’'s a fact, taller people sleep longer in bed.

Re: [flask] Problem with directory names

From:
Steven Kryskalla
Date:
2013-06-01 @ 19:27
On Sat, Jun 1, 2013 at 8:26 AM, MMN <mmn007@gmail.com> wrote:
> I got rid of the problem by renaming the directory to order_util. It looks
> like whatever I was doing was correct from the documentation. Can some one
> please tell me if I am doing something wrong?

Are you setting template_folder on your blueprints? If not, I think
render_template will search alphabetically, as you saw. I doubt
there's something in flask that automatically knows which template
directory to look in based on the blueprint's name.

Re: [flask] Problem with directory names

From:
Mmn
Date:
2013-06-02 @ 04:26
Thanks Steven. When I create the template_folder, the doc says that I
should create a directory with name as order under templates folder and
then start the directory hierarchy from there. So I assumed that flask
automatically goes to order directory when my url is order. At least the
templates for order_blueprint are being looked up from the order directory
under templates, without any configuration. That is why I am confused.

Regards,


On Sun, Jun 2, 2013 at 12:57 AM, Steven Kryskalla <skryskalla@gmail.com>wrote:

> On Sat, Jun 1, 2013 at 8:26 AM, MMN <mmn007@gmail.com> wrote:
> > I got rid of the problem by renaming the directory to order_util. It
> looks
> > like whatever I was doing was correct from the documentation. Can some
> one
> > please tell me if I am doing something wrong?
>
> Are you setting template_folder on your blueprints? If not, I think
> render_template will search alphabetically, as you saw. I doubt
> there's something in flask that automatically knows which template
> directory to look in based on the blueprint's name.
>



-- 
--
It’'s a fact, taller people sleep longer in bed.