Repository navigation
fix(examples): check starters against the module that mounts Citry; start Django before importing the app - #236
Merged
Merged
Conversation
…itry `citry check` checks template links only when a framework integration told Citry which paths the app serves while the app loaded. The FastAPI, Django, and Flask starters and the project board demo pointed `--app` at the module that only creates the Citry instance, so their checks printed a "links not checked" note. - FastAPI starter and both FastAPI demos: `app.main:citry_app`. The htmx demo has no literal links in its templates today, so it printed no note, but it follows the same rule. - Django starter: `config.urls:citry_app`. - Flask starter: new `app/wsgi.py` builds the app with `create_app()`; the check uses `app.wsgi:citry_app`. - Bare ASGI and WSGI starters keep `app.citry_app:citry_app`: they route requests in their own code, and no public API lets them tell Citry their paths. Their READMEs say the note is expected. The catalog, READMEs, AGENTS.md files, project workflows, and VS Code settings are updated to match. Clean-copy qualification now fails a FastAPI, Django, or Flask project whose check prints either note that says links were skipped. The template-linting page links to the starters, the IDE pages point to it, and the example-projects design doc records the rule. The starters' lockfiles still pin Citry 0.6.0, which has no link check, so a copied starter prints neither the findings nor the note until the locks are refreshed at the next release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dule `citry --app config.urls:citry_app check` failed with AppRegistryNotReady as soon as the URL configuration imported a model, usually through its views: the CLI and the editor's app worker imported the module before Django had loaded its apps. When DJANGO_SETTINGS_MODULE is set, `load_app()` (every `citry --app` command) and the citry-lsp app worker now call django.setup() first, as manage.py does. The new `citry._django_startup` module holds that step. The Django link checker calls the module's `start_django()`, which returns at once when the apps are loaded or loading, so Django starts once per process. The app worker carries a small copy of the step for an app that runs on an older Citry without the new module. If the variable is set but Django is not installed, the message names the variable and says how to fix it. If the settings module fails to import, raises, or exits, the message carries Django's own error and suggests unsetting the variable for a project that does not use Django. Fresh-process tests cover the CLI and the app worker with a project whose urls.py imports a model through views.py. The CLI, VS Code, PyCharm, and template-linting docs, the url-checker-missing fix text, the extension-commands design note, and both changelogs describe it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A variable left over from another shell made every `citry --app` command fail in a project that does not use Django. Without Django installed the project cannot be a Django one, so the CLI step and the app worker's copy of it now skip starting Django. An installed Django that fails to start still reports Django's own error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
fix/starters-mount-check
branch
from
October 21, 2026 16:36
94a2a86 to
74ccf4c
Compare
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #234; merge that first. It follows up #233's link check (
rule_unknown_url). A link checker is registered only when the module given to--appmounts Citry, so this PR points each starter's check at that module, and makes the Django target work.Starter check commands
--apptargetapp.main:citry_appconfig.urls:citry_appapp.wsgi:citry_app, from a newapp/wsgi.pythat callscreate_app()and re-exportscitry_app, as the docs describeapp.citry_app:citry_appEach changed project's catalog entry, README,
AGENTS.md,.github/workflows/check.ymland.vscode/settings.jsonuse the new target. The bare ASGI and WSGI starters have no integration that can register a checker, so they keep the "links not checked" note; their READMEs say it's expected and that the check still passes. Clean-copy qualification now fails a FastAPI, Django or Flask project whose check prints that note.Django: start Django before importing the app
With
--app config.urls:citry_app,citry checkfailed withAppRegistryNotReadyas soon asurls.pyimported a model. The editor's app worker failed the same way. The old target failed the same way once a component imported a model.DJANGO_SETTINGS_MODULEis set, the CLI and the app worker now calldjango.setup()before importing the--appmodule, asmanage.pydoes.Evidence
urls.pyimports a model throughviews.pypasses in both the CLI and the app worker, and starts Django exactly once. Without the fix it fails withAppRegistryNotReady.scripts/validate.pypass. ruff is clean, and mypy is clean, including with--platform linux.Known limit
The starters' lockfiles pin Citry 0.6.0, which has no link check. Until those locks are refreshed at the next release, a copied starter shows neither link findings nor the note.
🤖 Generated with Claude Code