You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Link check reports correct links for a Django app whose sub-path comes from the server #465
citry.template.unknown-url reports correct links as missing when a Django app is served below a sub-path that only the server sets, through the WSGI or ASGI SCRIPT_NAME, and FORCE_SCRIPT_NAME is not set.
For example, the app runs under /shop, behind gunicorn with SCRIPT_NAME=/shop, and a template has <a href="/shop/cart">. Django serves that link, but the check reports it.
Why
The Django path checker in packages/py/citry/citry/contrib/django.py (the check() function returned for urlpatterns()) removes the sub-path using get_script_prefix(). Outside a request, that prefix comes only from FORCE_SCRIPT_NAME, which django.setup() applies. A sub-path from the server is set per request, so citry check and the editor see /. They then compare /shop/cart with the URL patterns as if it were served at the site root, and nothing matches.
The same thing happens with FastAPI's root_path and Flask's APPLICATION_ROOT (contrib/fastapi.py:104, contrib/flask.py:173), where the checker always compares against the site root.
Current workaround
Documented in #464 under "Unexpected link results": set FORCE_SCRIPT_NAME to the same sub-path, or set rule_unknown_url to "ignore" for that app.
Possible fix
Give the app a way to tell the check its sub-path. That could be a Citry setting, or reading it from the env file, or a parameter to urlpatterns() and mount(). The checker would then remove the sub-path before it asks the framework, for all three integrations. Whatever is chosen, it should say what happens with an empty value, a value with no leading /, or a value with a trailing /.
Decision (Juro): the rest of this issue, a sub-path that only the server sets (gunicorn's SCRIPT_NAME, uvicorn's --root-path), gets option (a), a Citry setting that tells the link check the sub-path. It is scheduled after 0.7.0. #472 covers the part that reads each framework's own setting (FastAPI root_path, Flask APPLICATION_ROOT, Django FORCE_SCRIPT_NAME).
Activity
JuroOravec commentedon Oct 28, 2026
Decision (Juro): the rest of this issue, a sub-path that only the server sets (gunicorn's
SCRIPT_NAME, uvicorn's--root-path), gets option (a), a Citry setting that tells the link check the sub-path. It is scheduled after 0.7.0. #472 covers the part that reads each framework's own setting (FastAPIroot_path, FlaskAPPLICATION_ROOT, DjangoFORCE_SCRIPT_NAME).fix: check links below the sub-path an app is served at