0
votes

I've installed django-webpush in my project and put {% webpush_header %} in the <head> part of my HTML template as instructed, however I am getting an error:

NoReverseMatch at /
Reverse for 'save_webpush_info' not found. 'save_webpush_info' is not a valid view function or pattern name.

I use {% load webpush_notifications %} above that and have added webpush as part of the INSTALLED_APPS, along with the following in urls.py:

url(r'^webpush/', include('webpush.urls')),

https://github.com/safwanrahman/django-webpush

1
Do you have something like app_name = "<something>" in your urls.py? - Abdul Aziz Barkat
I do... good point! Is there a way to ignore that app_name context specifically for this url/path? - jjwood1600
Perhaps include them in your project level urls, or put the apps patterns and this pattern in different lists and include both in the urlpatterns list and pass the namespace to include. - Abdul Aziz Barkat

1 Answers

1
votes

I assume your urls.py is something like so:

app_name = '<something>'

urlpatterns = [
    # Other patterns
    url(r'^webpush/', include('webpush.urls')),
]

Instead do something like:

from django.urls import path


app_urls = (
    [
        # Other patterns
    ],
    '<something>' # Specifying app_namespace
)

urlpatterns = [
    path('', include(app_urls)),
    path('webpush/', include('webpush.urls')),
]

Edit: As these are urls of a third party package it would be best to put them in your projects top - level urls.py. If you want the paths to be similar to this apps:

path('path/to/some_app/webpush/', include('webpush.urls')),