librelist archives

« back to archive

Hi! I'm new and have a templateNotFound problem ^_^

Hi! I'm new and have a templateNotFound problem ^_^

From:
Italo Maia
Date:
2010-07-19 @ 06:15
Hi, I'm Italo. Nice to meet you. Lovely micro-framework.

By the way, i started an app here and had this nasty template not found
problem. My app directory tree is like this:

project/
..main.py
..templates/
....base.html
..apps/
....__init__.py
....auth/
......views.py
......templates/
........login.html

In auth/views.py i have:

*# auth/views.py
from* flask *import* Module, render_template, url_for, redirect
auth = Module(__name__)

*@auth.route('/login')*
*def* login():
....return render_template("login.html")


login.html gives me a templatenotfound error : / Does anyone know what am I
doing wrong?
Thanks in advance.

-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
bruce bushby
Date:
2010-07-21 @ 16:07
Hi Italo

A few weeks ago I posted to the list looking for flask developer as I wanted
to pay to have these sort of examples coded up and added to the examples
folder, unfortunately I did not received any response.

Have you managed to figure it out? I'm happy to send my example although
it's very basic and looks like this:
[root@ahlx veritrack]# pwd
/var/www/html/veritrack
[root@ahlx veritrack]# find . | grep -v cache
.
./veritrack
./veritrack/__init__.pyc
./veritrack/static
./veritrack/views.pyc
./veritrack/views.py
./veritrack/templates
./veritrack/__init__.py
./run
./run/gunicorn.pid
./server.py
./tmp
./log
./log/gunicorn.log
[root@ahlx veritrack]#


The flask 0.6dev documentation goes into further detail however I think my
lack of Python experience makes it difficult for me to get it working.

It would be great to have some examples of the two "getting bigger" layouts:

/yourapplication
    /yourapplication
        /__init__.py
        /views
            __init__.py
            admin.py
            frontend.py
        /static
            /style.css
        /templates
            layout.html
            index.html
            login.html
            ...


This one makes me think Flask can take some of the bigger frameworks:h

/yourapplication
    __init__.py
    /apps
        /frontend
            __init__.py
            views.py
            /static
                 style.css
            /templates
                 index.html
                 about.html
                 ...
        /admin
            __init__.py
            views.py
            /static
                 style.css
            /templates
                 list_items.html
                 show_item.html



My offer to purchase examples still stands if anybody has the time?

Cheers
Bruce









On Mon, Jul 19, 2010 at 7:15 AM, Italo Maia <italo.maia@gmail.com> wrote:

> Hi, I'm Italo. Nice to meet you. Lovely micro-framework.
>
> By the way, i started an app here and had this nasty template not found
> problem. My app directory tree is like this:
>
> project/
> ..main.py
> ..templates/
> ....base.html
> ..apps/
> ....__init__.py
> ....auth/
> ......views.py
> ......templates/
> ........login.html
>
> In auth/views.py i have:
>
> *# auth/views.py
> from* flask *import* Module, render_template, url_for, redirect
> auth = Module(__name__)
>
> *@auth.route('/login')*
> *def* login():
> ....return render_template("login.html")
>
>
> login.html gives me a templatenotfound error : / Does anyone know what am I
> doing wrong?
> Thanks in advance.
>
> --
> "A arrogância é a arma dos fracos."
>
> ===========================
> Italo Moreira Campelo Maia
> Graduado em Ciência da Computação - UECE
> Desenvolvedor WEB e Desktop (Java, Python, Lua)
> Coordenador do Pug-CE
> -----------------------------------------------------
> http://www.italomaia.com/
> http://twitter.com/italomaia/
> http://eusouolobomau.blogspot.com/
> -----------------------------------------------------
> turtle linux 910 - http://tiny.cc/blogturtle910
> ===========================
>
>

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Dan Jacob
Date:
2010-07-21 @ 16:19
Hi,

I'm working on a spare-time project at the moment. It's basically a
Reddit clone - not very interesting in of itself, but really just an
experiment in building a larger-scale application using Flask +
extensions.

Source code is here:

http://bitbucket.org/danjac/newsmeme

It's very, very much a work in progress, so please don't post tickets
just yet. I'll deploy a demo on my Webfaction server when it's in
decent shape.

I'll also do a write up on the architecture and any
problems/issues/gotchas either here on the mailing list or my blog
when I'm done.

So far - looking good, no major problems with Flask at all really.
It's also a good testing ground for extensions, particularly ones I've
written, and it's helped to fix issues upstream.

On 21 July 2010 17:07, bruce bushby <bruce.bushby@googlemail.com> wrote:
> Hi Italo
>
> A few weeks ago I posted to the list looking for flask developer as I wanted
> to pay to have these sort of examples coded up and added to the examples
> folder, unfortunately I did not received any response.
>
> Have you managed to figure it out? I'm happy to send my example although
> it's very basic and looks like this:
> [root@ahlx veritrack]# pwd
> /var/www/html/veritrack
> [root@ahlx veritrack]# find . | grep -v cache
> .
> ./veritrack
> ./veritrack/__init__.pyc
> ./veritrack/static
> ./veritrack/views.pyc
> ./veritrack/views.py
> ./veritrack/templates
> ./veritrack/__init__.py
> ./run
> ./run/gunicorn.pid
> ./server.py
> ./tmp
> ./log
> ./log/gunicorn.log
> [root@ahlx veritrack]#
>
>
> The flask 0.6dev documentation goes into further detail however I think my
> lack of Python experience makes it difficult for me to get it working.
>
> It would be great to have some examples of the two "getting bigger" layouts:
>
> /yourapplication
>     /yourapplication
>         /__init__.py
>         /views
>             __init__.py
>             admin.py
>             frontend.py
>         /static
>             /style.css
>         /templates
>             layout.html
>             index.html
>             login.html
>             ...
>
>
> This one makes me think Flask can take some of the bigger frameworks:h
>
> /yourapplication
>     __init__.py
>     /apps
>         /frontend
>             __init__.py
>             views.py
>             /static
>                  style.css
>             /templates
>                  index.html
>                  about.html
>                  ...
>         /admin
>             __init__.py
>             views.py
>             /static
>                  style.css
>             /templates
>                  list_items.html
>                  show_item.html
>
>
>
> My offer to purchase examples still stands if anybody has the time?
>
> Cheers
> Bruce
>
>
>
>
>
>
>
>
>
> On Mon, Jul 19, 2010 at 7:15 AM, Italo Maia <italo.maia@gmail.com> wrote:
>>
>> Hi, I'm Italo. Nice to meet you. Lovely micro-framework.
>>
>> By the way, i started an app here and had this nasty template not found
>> problem. My app directory tree is like this:
>>
>> project/
>> ..main.py
>> ..templates/
>> ....base.html
>> ..apps/
>> ....__init__.py
>> ....auth/
>> ......views.py
>> ......templates/
>> ........login.html
>>
>> In auth/views.py i have:
>>
>> # auth/views.py
>> from flask import Module, render_template, url_for, redirect
>> auth = Module(__name__)
>>
>> @auth.route('/login')
>> def login():
>> ....return render_template("login.html")
>>
>> login.html gives me a templatenotfound error : / Does anyone know what am
>> I doing wrong?
>> Thanks in advance.
>> --
>> "A arrogância é a arma dos fracos."
>>
>> ===========================
>> Italo Moreira Campelo Maia
>> Graduado em Ciência da Computação - UECE
>> Desenvolvedor WEB e Desktop (Java, Python, Lua)
>> Coordenador do Pug-CE
>> -----------------------------------------------------
>> http://www.italomaia.com/
>> http://twitter.com/italomaia/
>> http://eusouolobomau.blogspot.com/
>> -----------------------------------------------------
>> turtle linux 910 - http://tiny.cc/blogturtle910
>> ===========================
>>
>
>

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
bruce bushby
Date:
2010-07-22 @ 21:15
Hi Dan

Thanks for posting this!!! It's a nice compact example of what I've been
struggling with.

Cheers
Bruce



On Wed, Jul 21, 2010 at 5:19 PM, Dan Jacob <danjac354@gmail.com> wrote:

> Hi,
>
> I'm working on a spare-time project at the moment. It's basically a
> Reddit clone - not very interesting in of itself, but really just an
> experiment in building a larger-scale application using Flask +
> extensions.
>
> Source code is here:
>
> http://bitbucket.org/danjac/newsmeme
>
> It's very, very much a work in progress, so please don't post tickets
> just yet. I'll deploy a demo on my Webfaction server when it's in
> decent shape.
>
> I'll also do a write up on the architecture and any
> problems/issues/gotchas either here on the mailing list or my blog
> when I'm done.
>
> So far - looking good, no major problems with Flask at all really.
> It's also a good testing ground for extensions, particularly ones I've
> written, and it's helped to fix issues upstream.
>
>

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Armin Ronacher
Date:
2010-07-19 @ 07:09
Hi,

On 7/19/10 8:15 AM, Italo Maia wrote:
> login.html gives me a templatenotfound error : / Does anyone know what
> am I doing wrong?
> Thanks in advance.
You have to do "render_template('auth/login.html')".  The module name is 
not automatically put in front of templates.


Regards,
Armin

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Italo Maia
Date:
2010-07-20 @ 05:30
Is there any "becoming big" open source project that i can take as example?

2010/7/19 Armin Ronacher <armin.ronacher@active-4.com>

> Hi,
>
> On 7/19/10 8:15 AM, Italo Maia wrote:
> > login.html gives me a templatenotfound error : / Does anyone know what
> > am I doing wrong?
> > Thanks in advance.
> You have to do "render_template('auth/login.html')".  The module name is
> not automatically put in front of templates.
>
>
> Regards,
> Armin
>



-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================

Re: Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
edgar
Date:
2010-07-20 @ 01:09
could not decode message

Re: Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Ron DuPlain
Date:
2010-07-20 @ 01:12
On Mon, Jul 19, 2010 at 9:09 PM, edgar <edgarymr@gmail.com> wrote:
> tell me how to unsubscription this mail list.
>
> thanks...
>
> regards
> edgar
> edgarymr@gmail.com

To unsubscribe, please send an email to flask-unsubscribe@librelist.com

See:
http://librelist.com/help.html

-Ron

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Italo Maia
Date:
2010-07-19 @ 15:47
That doesn't work either. This apps/auth/login.html doesn't work as well.

2010/7/19 Armin Ronacher <armin.ronacher@active-4.com>

> Hi,
>
> On 7/19/10 8:15 AM, Italo Maia wrote:
> > login.html gives me a templatenotfound error : / Does anyone know what
> > am I doing wrong?
> > Thanks in advance.
> You have to do "render_template('auth/login.html')".  The module name is
> not automatically put in front of templates.
>
>
> Regards,
> Armin
>



-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Italo Maia
Date:
2010-07-20 @ 06:31
Just tried checking jinja_env from command line. It doesn't even listen the
login.html template. Is there something special i need to do in main.py for
flask to find the templates? Right now, auth_app is loaded like this:

*from* apps.auth.views *import* auth
app = Flask("project")
app.register_module(auth)
app.run()


2010/7/19 Italo Maia <italo.maia@gmail.com>

> That doesn't work either. This apps/auth/login.html doesn't work as well.
>
> 2010/7/19 Armin Ronacher <armin.ronacher@active-4.com>
>
> Hi,
>>
>> On 7/19/10 8:15 AM, Italo Maia wrote:
>> > login.html gives me a templatenotfound error : / Does anyone know what
>> > am I doing wrong?
>> > Thanks in advance.
>> You have to do "render_template('auth/login.html')".  The module name is
>> not automatically put in front of templates.
>>
>>
>> Regards,
>> Armin
>>
>
>
>
> --
> "A arrogância é a arma dos fracos."
>
> ===========================
> Italo Moreira Campelo Maia
> Graduado em Ciência da Computação - UECE
> Desenvolvedor WEB e Desktop (Java, Python, Lua)
> Coordenador do Pug-CE
> -----------------------------------------------------
> http://www.italomaia.com/
> http://twitter.com/italomaia/
> http://eusouolobomau.blogspot.com/
> -----------------------------------------------------
> turtle linux 910 - http://tiny.cc/blogturtle910
> ===========================
>



-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================

Re: [flask] Hi! I'm new and have a templateNotFound problem ^_^

From:
Italo Maia
Date:
2010-07-20 @ 06:58
Problem was i did not set the module url_prefix. gee! Solved = ]

app.register_module(auth, url_prefix="/auth") *# <= this works!*


2010/7/20 Italo Maia <italo.maia@gmail.com>

> Just tried checking jinja_env from command line. It doesn't even listen the
> login.html template. Is there something special i need to do in main.py for
> flask to find the templates? Right now, auth_app is loaded like this:
>
> *from* apps.auth.views *import* auth
> app = Flask("project")
> app.register_module(auth)
> app.run()
>
>
> 2010/7/19 Italo Maia <italo.maia@gmail.com>
>
> That doesn't work either. This apps/auth/login.html doesn't work as well.
>>
>> 2010/7/19 Armin Ronacher <armin.ronacher@active-4.com>
>>
>> Hi,
>>>
>>> On 7/19/10 8:15 AM, Italo Maia wrote:
>>> > login.html gives me a templatenotfound error : / Does anyone know what
>>> > am I doing wrong?
>>> > Thanks in advance.
>>> You have to do "render_template('auth/login.html')".  The module name is
>>> not automatically put in front of templates.
>>>
>>>
>>> Regards,
>>> Armin
>>>
>>
>>
>>
>> --
>> "A arrogância é a arma dos fracos."
>>
>> ===========================
>> Italo Moreira Campelo Maia
>> Graduado em Ciência da Computação - UECE
>> Desenvolvedor WEB e Desktop (Java, Python, Lua)
>> Coordenador do Pug-CE
>> -----------------------------------------------------
>> http://www.italomaia.com/
>> http://twitter.com/italomaia/
>> http://eusouolobomau.blogspot.com/
>> -----------------------------------------------------
>> turtle linux 910 - http://tiny.cc/blogturtle910
>> ===========================
>>
>
>
>
> --
> "A arrogância é a arma dos fracos."
>
> ===========================
> Italo Moreira Campelo Maia
> Graduado em Ciência da Computação - UECE
> Desenvolvedor WEB e Desktop (Java, Python, Lua)
> Coordenador do Pug-CE
> -----------------------------------------------------
> http://www.italomaia.com/
> http://twitter.com/italomaia/
> http://eusouolobomau.blogspot.com/
> -----------------------------------------------------
> turtle linux 910 - http://tiny.cc/blogturtle910
> ===========================
>



-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================