django - NameError name 'Views' is not defined -
from django.conf.urls import url, patterns, include django.contrib import admin django.views.generic import templateview collection import * #from collection.views import index,thing_detail,edit_thing urlpatterns = [ url(r'^$', views.index, name='home'), url(r'^about/$',templateview.as_view(template_name='about.html'),name='about'), url(r'^contact/$',templateview.as_view(template_name='contact.html'),name='contact'), url(r'^things/(?p<slug>[-\w]+)/$', 'views.thing_detail' ,name='thing_detail'), url(r'^things/(?p<slug>[-\w]+)/edit/$', 'views.edit_thing',name='edit_thing'), url(r'^admin/', include(admin.site.urls)), ]
after running server there error "nameerror: name 'views' not defined"
any ??
you aren't importing own views.
try adding urls.py
:
from . import views
or if importing them specific app, try replacing .
app name
Comments
Post a Comment