librelist archives

« back to archive

AttributeError: 'Flask' object has no attribute 'cli'

AttributeError: 'Flask' object has no attribute 'cli'

From:
Angus Macnab
Date:
2014-05-09 @ 20:49
Sorry this question is so green, but I'm a newb and didn't see this
addressed in the archive:

I've been working through the tutorial and am getting an error that I can't
resolve regarding the Flask object having no cli atribute.  It stems from
line 48 of the flaskr.py example problem.  Code snippet and command line
input/output below.

Thanks for your help!
...
@app.cli.command('initdb')
def initdb_command():
    """Creates the database tables."""
    init_db()
    print('Initialized the database.')
...

$ ~/flaskr/flask/examples/flaskr $ python flaskr_tests.py
Traceback (most recent call last):
  File "flaskr_tests.py", line 12, in <module>
    import flaskr
  File "/Users/angus/flaskr/flask/examples/flaskr/flaskr.py", line 48, in
<module>
    @app.cli.command('initdb')
AttributeError: 'Flask' object has no attribute 'cli'

Re: [flask] AttributeError: 'Flask' object has no attribute 'cli'

From:
Farhan
Date:
2014-05-09 @ 21:40
Hi Angus,

Take a look at this following issue. Make sure you are using the latest 
code from the dev branch. This issue seems to originate from an older dev 
branch, IIRC.

Best,
Farhan

On May 9, 2014, at 1:49 PM, Angus Macnab <angus.macnab@gmail.com> wrote:

> Sorry this question is so green, but I'm a newb and didn't see this 
addressed in the archive:
> 
> I've been working through the tutorial and am getting an error that I 
can't resolve regarding the Flask object having no cli atribute.  It stems
from line 48 of the flaskr.py example problem.  Code snippet and command 
line input/output below.
> 
> Thanks for your help!
> ...
> @app.cli.command('initdb')
> def initdb_command():
>     """Creates the database tables."""
>     init_db()
>     print('Initialized the database.')
> ...
> 
> $ ~/flaskr/flask/examples/flaskr $ python flaskr_tests.py 
> Traceback (most recent call last):
>   File "flaskr_tests.py", line 12, in <module>
>     import flaskr
>   File "/Users/angus/flaskr/flask/examples/flaskr/flaskr.py", line 48, 
in <module>
>     @app.cli.command('initdb')
> AttributeError: 'Flask' object has no attribute 'cli'

Re: [flask] AttributeError: 'Flask' object has no attribute 'cli'

From:
Angus Macnab
Date:
2014-05-10 @ 00:17
Excellent, thanks for your help with this, Farhan!  The stable release
works fine.

-Angus


On Fri, May 9, 2014 at 2:40 PM, Farhan <inshany@gmail.com> wrote:

> Hi Angus,
>
> Take a look at this following 
issue<https://github.com/mitsuhiko/flask/issues/1048>.
> Make sure you are using the latest code from the dev branch. This issue
> seems to originate from an older dev branch, IIRC.
>
> Best,
> Farhan
>
> On May 9, 2014, at 1:49 PM, Angus Macnab <angus.macnab@gmail.com> wrote:
>
> Sorry this question is so green, but I'm a newb and didn't see this
> addressed in the archive:
>
> I've been working through the tutorial and am getting an error that I
> can't resolve regarding the Flask object having no cli atribute.  It st ems
> from line 48 of the flaskr.py example problem.  Code snippet and command
> line input/output below.
>
> Thanks for your help!
> ...
> @app.cli.command('initdb')
> def initdb_command():
>     """Creates the database tables."""
>     init_db()
>     print('Initialized the database.')
> ...
>
> $ ~/flaskr/flask/examples/flaskr $ python flaskr_tests.py
> Traceback (most recent call last):
>   File "flaskr_tests.py", line 12, in <module>
>     import flaskr
>   File "/Users/angus/flaskr/flask/examples/flaskr/flaskr.py", line 48, in
> <module>
>     @app.cli.command('initdb')
> AttributeError: 'Flask' object has no attribute 'cli'
>
>
>