跟着麦叔学flask,感谢b站麦叔
This commit is contained in:
11
database.py
Executable file
11
database.py
Executable file
@@ -0,0 +1,11 @@
|
||||
import sqlite3
|
||||
from flask import g
|
||||
|
||||
DATABASE_owp = '/var/databases/sqlite/owp.db'
|
||||
|
||||
def get_owp_db():
|
||||
db = getattr(g, '_database', None)
|
||||
if db is None:
|
||||
db = g._database = sqlite3.connect(DATABASE_owp)
|
||||
db.row_factory = sqlite3.Row
|
||||
return db
|
||||
Reference in New Issue
Block a user