Richie1209
Richie1209

Reputation: 3

NoReverseMatch at /cms-admin/ Reverse for 'wagtailadmin_sprite' not found. 'wagtailadmin_sprite' is not a valid view function or pattern name

Trying to integrate Wagtail CMS into my website and have been successful as far as when I go to change the path name from '/admin' -> '/cms-admin' because it was causing conflict with the Django database admin page and I started getting the NoReverseMatch error for 'wagtailadmin_sprite' whenever I go to '8000/cms-admin'.

Here's the urls.py file:

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from wagtail.admin import urls as wagtailadmin_urls
from wagtail import urls as wagtail_urls

urlpatterns = [
    path('db-admin/', admin.site.urls),  # Django admin interface
    path('', include('apps.home.urls')),  # Home app URLs
    path('', include('apps.users.urls')),  # Users app URLs

    # Wagtail
    path('cms-admin/', include(('wagtail.admin.urls', 'wagtailadmin'), namespace='wagtailadmin')),  # Wagtail admin with a unique namespace
    path('documents/', include(('wagtail.documents.urls', 'wagtaildocs'), namespace='wagtaildocs')),  # Wagtail documents with a unique namespace
    path('', include('wagtail.urls')),  # Wagtail page serving
]  

'wagtailadmin_sprite' is shown when I search for the URL list in the terminal and all INSTALLED_APPS have been correctly included in settings.py.

Using up-to-date Django and Wagtail versions also.

Is there something I'm missing? Any ideas are appreciated.

Upvotes: 0

Views: 29

Answers (1)

gasman
gasman

Reputation: 25227

Specifying a namespace when including Wagtail's URLs is not valid, as there are numerous places in Wagtail's code that refer to these routes without a namespace. (However, they always have wagtail as a prefix on the URL name, as in wagtailadmin_sprite, so there's no risk of naming collisions with your own URL routes.)

You should use a plain include without a namespace argument instead:

path('cms-admin/', include('wagtail.admin.urls')),

Upvotes: 0

Related Questions