django/mysite/polls tutorial error

237 views
Skip to first unread message

ginost7

unread,
Oct 2, 2018, 9:24:35 AM10/2/18
to Django users
Hello

I am trying the django/mysite/polls tutorial.

After typing, actually copying and pasting this:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),
]

Running this command ( i am using python 3)

$ python3 manage.py runserver
I get the following error:

raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'polls.urls' from
 '/home/gino/djangoDEV/mysite/polls/urls.py'>' does not appear to have any patterns in it.
 If you see valid patterns in the file then the issue is probably caused by a circular import.

CAN ANYBODY tell me what IS WRONG???

Joel Mathew

unread,
Oct 2, 2018, 9:29:12 AM10/2/18
to django...@googlegroups.com
Well, what does /home/gino/djangoDEV/mysite/polls/urls.py contain?




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b0f1750-24dd-4dd1-8658-f68e9156a911%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ginost7

unread,
Oct 2, 2018, 9:46:52 AM10/2/18
to Django users


On Tuesday, 2 October 2018 14:29:12 UTC+1, Joel wrote:
Well, what does /home/gino/djangoDEV/mysite/polls/urls.py contain?

I am just following the first django app tutorial

mysite/polls/urls.py contains the following code:


from django.urls import path

from . import views

urlpatterns = [
path('', views.index, name='index'),
]

 

ginost7

unread,
Oct 2, 2018, 10:06:00 AM10/2/18
to Django users
Hello apparently in polls/urls.py i changed the dot :

from django.urls import path

from .import views # PLEASE NOTE THERE IS NO SPACE BETWEEN DOT AND IMPORT!!!

ginost7

unread,
Oct 2, 2018, 10:10:25 AM10/2/18
to Django users
now i get a different error!!!

path('', views.index, name='index'),
AttributeError: module 'polls.views' has no attribute 'index'


Burak Mavzer

unread,
Oct 2, 2018, 10:58:43 AM10/2/18
to Django users
Hello, please check your polls/views.py file and make sure you have defined an index function that should somewhat look like this:

from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello.")
Reply all
Reply to author
Forward
0 new messages