[Bug] Django inline include([...]) lists lose the enclosing URL prefix

Open
#6,443 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@canblmz1 is already working on this.

Since Nov 26, 2026.

  • #6464 by @canblmz1 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
django, python
Domain
backend

Research direction

Read packages/core/src/repowise/core/ingestion/framework_routes.py around lines 985–1015 and packages/core/src/repowise/core/workspace/extractors/http/django.py around lines 58–79, then inspect the listed cases in tests/unit/workspace/test_framework_routes.py. The issue says to handle nested inline includes at any depth, preserve ^$ as the enclosing prefix, and compose router URLs under their entry prefix; the linked open pull request shows work is already underway.

Written by the indexing model from the issue text.

Description

bug help wanted

Summary

An inline include([...]) list in a Django URLconf loses the prefix of the entry that encloses it, and a router mounted with include(router.urls) under a prefix is not composed either.

packages/core/src/repowise/core/ingestion/framework_routes.py:985-1015, packages/core/src/repowise/core/workspace/extractors/http/django.py:58-79

Mechanism

  • django_includes yields (prefix, module) only when the include argument is a dotted module or expression (_DJANGO_INCLUDE_ARG_RE). A list literal is not an include target.
  • django_routes reads every entry in the file flat, so a nested entry gets its own pattern only, and re_path("^$", ...) normalises to empty and is dropped.

Repro

paperless-ngx src/paperless/urls.py: re_path("^api/", include([... re_path("^search/", include([...]))])) gives /autocomplete for /api/search/autocomplete, and /api/profile is missing. 16 of 31 in-repo consumers have no provider. Minimal fixture on main:

urlpatterns = [
    re_path("^api/", include([
        re_path("^search/", include([re_path("^autocomplete/", views.autocomplete)])),
        re_path("^$", views.root),
    ])),
]
provider http::*::/autocomplete     (expected /api/search/autocomplete and /api)

DRF router routes link only through the prefix_stripped fallback because include(api_router.urls) under ^api/ is not composed.

Impact

Django apps that nest URLconfs in one file get providers at the wrong paths.

Done looks like

  • Track bracket depth so an inline list inherits the enclosing prefix, at any depth.
  • Keep ^$ entries as the prefix itself.
  • Compose include(<router>.urls) under its entry prefix.

Tests

tests/unit/workspace/test_framework_routes.py: nested include, ^$, router urls.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.