python - Django - page not found 404 -
i'm trying create site using django. have index view working, want create simple custom view , map unable to. i'm getting 404 error.
the app inside project called emails.
here files:
base/urls.py
from django.conf.urls import patterns, include, url django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^emails/$', include('emails.urls')), ) emails/urls.py
from django.conf.urls import patterns, include, url emails import views urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^custom/$', views.custom, name='custom'), ) emails/views.py
from django.http import httpresponse def index(request): return httpresponse("hello world, you're @ index.") def custom(request): return httpresponse("this custom view.") here 404:
using urlconf defined in crm.urls, django tried these url patterns, in order:
^admin/ ^/emails/$ the current url, emails/custom, didn't match of these.
when visit localhost:8000/emails/ - see index view. localhost:8000/emails/custom/ returning 404 error. appreciated!
this url(r'^emails/$', include('emails.urls')), should without dollar sign $:
url(r'^emails/', include('emails.urls')),
you don't want end path after emails, don't end string regex character $. let able continued in other urls.py file
Comments
Post a Comment