My root urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('webarticles.urls')),
]
While I have seen this error answered on stackoverflow before, they don't seem to work for me. Specifically there are 2 components of the answers that confuse me:
- Why url is used instead of path
- If I am to import webarticles, how to do that given that my project and app are on the same level
Thank you for any help you are able to provide!
CodePudding user response:
Make sure your urls.py in webarticles app has the following too:
urlpatterns = [
path('', views.index, name='index'),
]
Or whatever url list you are using in your app.
CodePudding user response:
======== For Project urls.py ========
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include("webarticles.urls")),
]
======== For webarticles (app) urls.py ========
from django.urls import path
from webarticles.views import *
urlpatterns = [
path('',DemoView1,name="demo1"),
path('demo2/', DemoView2, name="demo2"),
path('demo3/', DemoView3, name="demo3"),
]