0

I am doing the django tutorial so I am literally cutting and pasting code. I keep getting this error on step 1

 from django.conf.urls import url
 from django.conf.urls import include

 from . import views

 urlpatterns = [
       url(r'^$', views.index, name='index'),
 ]

I am getting this error

 */django/theSite/polls/urls.py", line 8, in <module>
     url(r'^$', views.index, name='index'),
 AttributeError: 'module' object has no attribute 'index'

edit: my views module is this

 from django.shortcuts import render

 # Create your views here.
 from django.http import HttpResponse


 def index(request):
     return HttpResponse("Hello, world. You're at the polls index.")

I cant see what I missed do you have any advice? Thanks!

Kyle Sponable
  • 735
  • 1
  • 12
  • 31

1 Answers1

1

The answer was indeed there had to be something wrong with my views. Deleting the django project and rebuilding the entire tutorial from scratch remedied the issue.

Kyle Sponable
  • 735
  • 1
  • 12
  • 31