Skip to content

How to build python app blog#1786

Merged
Alek99 merged 2 commits intomainfrom
carlos/how-to-build-python-app
Mar 20, 2026
Merged

How to build python app blog#1786
Alek99 merged 2 commits intomainfrom
carlos/how-to-build-python-app

Conversation

@carlosabadia
Copy link
Copy Markdown
Collaborator

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR adds a new blog post ("How to Build a Python Web App: Complete Tutorial") and a minor spacing fix to code_block_dark that aligns its bottom margin (mb-4) with the existing code_block component.

The blog post is well-structured and covers the full Reflex development lifecycle. However, two code examples contain errors that would produce runtime failures for readers who copy-paste them:

  • Incorrect database query (session.exec(User).all()): session.exec() requires a select() statement, not a bare model class. The example is also missing the required select import.
  • Invalid dict Var attribute access (AppState.router.page.params.username): router.page.params is a Dict[str, str] Var; the correct access pattern is bracket notation ["username"], not dot notation.

Confidence Score: 3/5

  • Safe to merge after fixing the two broken code examples in the blog post.
  • The code.py change is trivial and correct. The blog post contains two code snippets that would produce runtime errors if followed — fixing them is necessary before publishing to avoid misleading readers.
  • blog/how-to-build-python-web-app-complete-tutorial.md — the database query and router params examples need correction.

Important Files Changed

Filename Overview
blog/how-to-build-python-web-app-complete-tutorial.md New blog tutorial covering Reflex full-stack development. Two code examples contain bugs: session.exec(User) must be session.exec(select(User)), and router.page.params.username should use bracket access ["username"].
pcweb/templates/docpage/blocks/code.py Minor style fix — adds mb-4 bottom margin to code_block_dark, making it consistent with the existing code_block component. No logic issues.

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser
    participant ReflexFrontend
    participant ReflexBackend
    participant Database

    User->>Browser: Visit page
    Browser->>ReflexFrontend: Load React (compiled from Python)
    ReflexFrontend->>ReflexBackend: WebSocket connection
    User->>ReflexFrontend: Click button (on_click event)
    ReflexFrontend->>ReflexBackend: Dispatch event handler
    ReflexBackend->>Database: session.exec(select(User)).all()
    Database-->>ReflexBackend: Return rows
    ReflexBackend-->>ReflexFrontend: State delta (updated vars)
    ReflexFrontend-->>Browser: Reactive UI update
Loading

Last reviewed commit: "add blog"

@Alek99 Alek99 self-requested a review March 20, 2026 17:49
@Alek99 Alek99 merged commit 0fe34ec into main Mar 20, 2026
10 checks passed
@Alek99 Alek99 deleted the carlos/how-to-build-python-app branch March 20, 2026 17:50
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 this pull request may close these issues.

2 participants