I am trying to make django app but this script error keeps coming

Viewed 33
from django.contrib import admin
from django.urls import path
from buttonpython2 import views
app_name = "buttonpython2"
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.button)
    path('', views.output, name="script")

]

this is my url.py this image shows the error enter image description here

1 Answers

Since you used app_name = 'buttonpython2', you should prefix the view name with the app_name, so:

{% url 'buttonpython2:script' %}

this will however not trigger the output view, since the pattern (completely) overlaps with that of the button view, and since the button path is defined before the script path, it will ths trigger the button view. You thus should define another path for the views.output.

Related