Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog tutorial has typo for path #347

Open
patriacaelum opened this issue Jun 18, 2024 · 0 comments · May be fixed by #348
Open

Blog tutorial has typo for path #347

patriacaelum opened this issue Jun 18, 2024 · 0 comments · May be fixed by #348

Comments

@patriacaelum
Copy link

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 patriacaelum linked a pull request Jun 18, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant