[Flask] Problems with a flask tutorial

nash nashef at gmail.com
Wed Apr 6 11:03:01 EDT 2016


Your app.config isn't setup, so initdb() can't setup the sqlite database.
It's looking for app.config['DATABASE'] to contain a filename. From the
flaskr tutorial:

http://flask.pocoo.org/docs/0.10/tutorial/setup/

I think you will want to go through most of the bits on that page.


--nash

On Tue, Apr 5, 2016 at 10:53 PM, Andreas Dorfner <
andreas.dorfner at stud.hs-regensburg.de> wrote:

> Hi all,
>
> to save the data in a database, I'm trying to use flask. For my first
> steps with flask, I'm working with the following online tutorial:
>
> http://flask.pocoo.org/docs/0.10/tutorial/dbinit/
>
> The web server on Beaglebone Black (with running Debian on it) is still
> working, but I have problems with "Step3: Creating the Database". By doing
> the online tutorial step by step, normally it should be possible to create
> a database by starting up a Python shell and import and call a function
> like that:
>
> Running a python shell:
> root at beaglebone:~/flaskr# python
>
>  >>> from flaskr import init_db
>  >>> init_db()
>
> By doing so, I get the following error message:
>
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "flaskr.py", line 28, in init_db
>      with closing(connect_db()) as db:
>    File "flaskr.py", line 23, in connect_db
>      return sqlite3.connect(app.config['DATABASE'])
> KeyError: 'DATABASE'
>
> Does anybody have an idea why I get this error?
> Attached you can find the source code and the database schema.
>
> Many thanks for your help.
> Andreas
>
>
>
>
> ---
> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
> https://www.avast.com/antivirus
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160406/d5e80a89/attachment.html>


More information about the Flask mailing list