1π
β
So to achieve your goal, change the projecβs url file as:
path('admin/', admin.site.urls),
path('task/',include('todolist_app.urls')),
path('',include('todolist_app.urls')), # change as this
Then you can get the following things:
127.0.0.1:8000/about
showing "welcome to about page"
127.0.0.1:8000/contact
showing "welcome to contact page"
127.0.0.1:8000/
showing "welcome to todolist app page"
The problem here was in project url file when you add path('todolist/',include('todolist_app.urls'))
, every urls in the todolist
app will be prefixed with the given string in project url file.
You can refer Django β URL Mapping for more.
π€ilyasbbu
0π
Add a slash after your route:
from django.urls import path
from todolist_app import views
urlpatterns = [
path('', views.todolist),
path('contact/', views.contact,name='contact'),
path('about/', views.about, name='about'), #the path can be anything.
]
π€Iqbal Hussain
- [Answered ]-Are there any known issues with django and multithreading?
- [Answered ]-How to pass a variable to class based views (ListView)
- [Answered ]-'Command' object has no attribute 'stdout'
- [Answered ]-Is there any acceptable way to chop/recombine Django querysets without using the API?
Source:stackexchange.com