I can't figure out why Django is unable to find the requested URL in my application.
Here is the error code I get:
Using the URLconf defined in littlelogsms.urls, Django tried these URL patterns, in this order:
^admin/
^$
The current URL, success/, didn't match any of these.
Here is my sms.urls.py file:
from django.conf.urls import url
from sms import views
urlpatterns = [
url(r'^success/$', views.success, name='success'),
url(r'^$', views.index, name='index')
]
Here is the application urls.py file:
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', include('sms.urls')),
]
I can't find the mistake I'm making. Any ideas?
This problem is the dollar sign in this url pattern.
url(r'^$', include('sms.urls')),
The caret ^
matches the beginning of the string, and the dollar $
matches the end if the string, so ^$
only matches the index URL /
.
You should remove the dollar and change it to:
url(r'^', include('sms.urls')),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With