zulln
zulln

Reputation: 49

Where does connect_to_database() comes from?

http://flask.pocoo.org/docs/0.10/patterns/sqlite3/

I get this: NameError: global name 'connect_to_database' is not defined

Can't really se where it should be defined either?

Upvotes: 0

Views: 930

Answers (1)

Eevee
Eevee

Reputation: 48594

At a glance, I assume you're supposed to write it yourself, doing whatever you need to do to get a db connection.

At its simplest, this would just be:

def connect_to_database():
    return sqlite3.connect(DATABASE)

Upvotes: 6

Related Questions