I am trying to build a website with Django. I am new to Django and have followed the Tango with Django tutorial. I keep getting an URlconf error I do not understand. I have a domain (www.example.com), an app (mainApp) and two views in mainApp (homePage, registration). I want
My urls.py file for the project is
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('mainApp.urls')),
)
The urls.py file for mainApp is
from django.conf.urls import patterns, url
from mainApp import views
urlpatterns = patterns(
'',
url(r'^$', views.homePage, name='homePage'),
url(r'^registration/$', views.registration, name='registration'),
)
This configuration displays the homePage view correctly, but not the registration view. The error is:
Using the URLconf defined in myProject.urls, Django tried these URL
patterns, in this order:
^admin/
^$
^/
The current URL, registration/, didn't match any of these.
What causes the error?
It looks fine. If you're hosting it online you should restart the webapp, if hosting it locally then restart the local host. Without restarting it the changes don't register.