quart icon indicating copy to clipboard operation
quart copied to clipboard

Blog tutorial has typo for path

Open patriacaelum opened this issue 1 year ago • 0 comments

The blog tutorial has a section that imports pathlib.Path but doesn't use it, causing the lines where the path to the db and schema files fail.

from pathlib import Path
from sqlite3 import dbapi2 as sqlite3

app.config.update({
  "DATABASE": app.root_path / "blog.db",
})

def _connect_db():
    engine = sqlite3.connect(app.config["DATABASE"])
    engine.row_factory = sqlite3.Row
    return engine

def init_db():
    db = _connect_db()
    with open(app.root_path / "schema.sql", mode="r") as file_:
        db.cursor().executescript(file_.read())
    db.commit()

Environment:

  • Python version: 3.12
  • Quart version: 0.19.6

patriacaelum avatar Jun 18 '24 08:06 patriacaelum