Re: AttributeError: module 'polls.views' has no attribute 'index' error in Django

2024-12-07 Thread Олександр Рябов
Guys, thanks for the help everyone but I just used vim and rewrote the code 
again)

On Thursday, 5 December 2024 at 15:02:36 UTC+3 Олександр Рябов wrote:

> Hello! I'm facing an issue when running my Django project. I get the 
> following error:
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> I've checked the following:  
> 1) In "polls/views.py", I have defined the index function:
> from django.http import HttpResponse
> 
> def index(request):
> return HttpResponse("Hello, World!")
>
> 2) In polls/urls.py, the path to this function is correctly defined:
> from django.urls import path, include
> from . import views
>
> urlpatterns = [
> path("", views.index, name="index"),
> ]
> 3) In the main mysite/urls.py, the URLs from polls are included:
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path("polls/", include("polls.urls")),
> path("admin/", admin.site.urls),
> ]
>
> However, when I run the server with the command:
> " python manage.py runserver "  
>
> I get the error mentioned above. I have also made sure that all imports 
> are correct and that the project is using the right Python version.
>
> What could be the cause of this error and how can I fix it? Thank you!
> P.S. 
> - I am writing my code in Visual Studio Code and have attached two 
> pictures for reference.
> - The first picture shows the general structure of my project.
> - The second picture displays the full error message from the command 
> line(*try to enlarge it, I hope you can see everything.)
> #1
>
> [image: photo_1.png]
> #2
> [image: photo_2.png]
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-users/f04cf8be-2103-4bb9-9ef3-7bf90ddbb1edn%40googlegroups.com.


Re: AttributeError: module 'polls.views' has no attribute 'index' error in Django

2024-12-06 Thread Abduljelil Zubairu
is your VS Code on auto save 

On Thursday, December 5, 2024 at 1:02:36 PM UTC+1 Олександр Рябов wrote:

> Hello! I'm facing an issue when running my Django project. I get the 
> following error:
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> I've checked the following:  
> 1) In "polls/views.py", I have defined the index function:
> from django.http import HttpResponse
> 
> def index(request):
> return HttpResponse("Hello, World!")
>
> 2) In polls/urls.py, the path to this function is correctly defined:
> from django.urls import path, include
> from . import views
>
> urlpatterns = [
> path("", views.index, name="index"),
> ]
> 3) In the main mysite/urls.py, the URLs from polls are included:
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path("polls/", include("polls.urls")),
> path("admin/", admin.site.urls),
> ]
>
> However, when I run the server with the command:
> " python manage.py runserver "  
>
> I get the error mentioned above. I have also made sure that all imports 
> are correct and that the project is using the right Python version.
>
> What could be the cause of this error and how can I fix it? Thank you!
> P.S. 
> - I am writing my code in Visual Studio Code and have attached two 
> pictures for reference.
> - The first picture shows the general structure of my project.
> - The second picture displays the full error message from the command 
> line(*try to enlarge it, I hope you can see everything.)
> #1
>
> [image: photo_1.png]
> #2
> [image: photo_2.png]
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-users/3ac25773-c449-444e-9d69-d20f23af18cdn%40googlegroups.com.


Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-07-26 Thread DJANGO DEVELOPER
as you mentioned that you're using django 3.2 but your urls.py file is
following the pattern of django 1.7.
use your urls.py this way : path('your polls url here', views.index,
name='index')

On Mon, Jul 26, 2021 at 6:45 PM Zain  wrote:

> Had the same issue.
>
> Solved, make sure you run each edited python file during the tutorial.
> I guess it needs to update. All I know is this fixed the issue.
>
> On Monday, April 19, 2021 at 2:07:34 AM UTC+10 avi.me...@gmail.com wrote:
>
>> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and
>> Django 3.2 and have exactly the same problems as mentioned above.
>>
>>     path('', views.index, name='index'),
>>
>> AttributeError: module 'polls.views' has no attribute 'index'
>>
>> any help on how can I debug this? I am a django noob
>>
>> On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:
>>
>>> Thanks for your reploy.
>>>
>>> Actually I followed the tutorial exactly.
>>>
>>> My polls/views.py has:
>>>
>>> from django.http import HttpResponse
>>>
>>>
>>> def index(request):
>>> return HttpResponse("Hello, world. You're at the polls index.")
>>>
>>> My polls/urls.py has:
>>>
>>> from django.conf.urls import url
>>>
>>> from . import views
>>>
>>> urlpatterns = [
>>> url(r'^$', views.index, name='index'),
>>> ]
>>>
>>>
>>> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>>>
>>>> You didn't give us enough info, but I am thinking that you don't have
>>>> an index() function in your polls/views.py. Start the tutorial from the
>>>> beginning and follow it closely.
>>>> On Apr 19, 2017 4:17 PM, Billy Lin  wrote:
>>>>
>>>> I'm following the getting started tutorial 01 and running into issues
>>>> after creating the polls app. Can someone please help?
>>>>
>>>> I'm using Python 3.6.1 and Django 1.11.
>>>>
>>>> Here's the detailed trace:
>>>>
>>>> Performing system checks...
>>>> Unhandled exception in thread started by >>> check_errors..wrapper at 0x04222810>
>>>> Traceback (most recent call last):
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>>>> line
>>>> 227, in wrapper
>>>> fn(*args, **kwargs)
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
>>>> nserver.py", line 125, in inner_run
>>>> self.check(display_num_errors=True)
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>> l
>>>> ine 359, in check
>>>> include_deployment_checks=include_deployment_checks,
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>> l
>>>> ine 346, in _run_checks
>>>> return checks.run_checks(**kwargs)
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>>>> l
>>>> ine 81, in run_checks
>>>> new_errors = check(app_configs=app_configs)
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>> line
>>>> 16, in check_url_config
>>>> return check_resolver(resolver)
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>> line
>>>> 26, in check_resolver
>>>> return check_method()
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>> line 25
>>>> 4, in check
>>>> for pattern in self.url_patterns:
>>>>   File
>>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.p

Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-07-26 Thread Zain
Had the same issue. 

Solved, make sure you run each edited python file during the tutorial. 
I guess it needs to update. All I know is this fixed the issue.

On Monday, April 19, 2021 at 2:07:34 AM UTC+10 avi.me...@gmail.com wrote:

> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and 
> Django 3.2 and have exactly the same problems as mentioned above.
>
> path('', views.index, name='index'),
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> any help on how can I debug this? I am a django noob
>
> On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:
>
>> Thanks for your reploy.
>>
>> Actually I followed the tutorial exactly.
>>
>> My polls/views.py has:
>>
>> from django.http import HttpResponse
>>
>>
>> def index(request):
>> return HttpResponse("Hello, world. You're at the polls index.")
>>
>> My polls/urls.py has:
>>
>> from django.conf.urls import url
>>
>> from . import views
>>
>> urlpatterns = [
>> url(r'^$', views.index, name='index'),
>> ]
>>
>>
>> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>>
>>> You didn't give us enough info, but I am thinking that you don't have an 
>>> index() function in your polls/views.py. Start the tutorial from the 
>>> beginning and follow it closely.
>>> On Apr 19, 2017 4:17 PM, Billy Lin  wrote:
>>>
>>> I'm following the getting started tutorial 01 and running into issues 
>>> after creating the polls app. Can someone please help?
>>>
>>> I'm using Python 3.6.1 and Django 1.11.
>>>
>>> Here's the detailed trace:
>>>
>>> Performing system checks...
>>> Unhandled exception in thread started by >> check_errors..wrapper at 0x04222810>
>>> Traceback (most recent call last):
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>>>  
>>> line
>>> 227, in wrapper
>>> fn(*args, **kwargs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
>>> nserver.py", line 125, in inner_run
>>> self.check(display_num_errors=True)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>  
>>> l
>>> ine 359, in check
>>> include_deployment_checks=include_deployment_checks,
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>  
>>> l
>>> ine 346, in _run_checks
>>> return checks.run_checks(**kwargs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>>>  
>>> l
>>> ine 81, in run_checks
>>> new_errors = check(app_configs=app_configs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>  
>>> line
>>> 16, in check_url_config
>>> return check_resolver(resolver)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>  
>>> line
>>> 26, in check_resolver
>>> return check_method()
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>  
>>> line 25
>>> 4, in check
>>> for pattern in self.url_patterns:
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>>  
>>> line
>>> 35, in __get__
>>> res = instance.__dict__[self.name] = self.func(instance)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>  
>>> line 40
>>> 5, in url_patterns
>>> patterns = getattr(self.urlconf_module, "urlpatterns", 
>>> self.urlconf_module)
>>>   File 
>>> "C:\Users\cephalin\AppD

Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-04-22 Thread David Nugent
On Mon, Apr 19, 2021 at 2:07 AM Avi Mehenwal  wrote:

> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and
> Django 3.2 and have exactly the same problems as mentioned above.
>
> path('', views.index, name='index'),
> AttributeError: module 'polls.views' has no attribute 'index'
>
> any help on how can I debug this? I am a django noob
>

We all started out that way.

>From the error message, assuming views it is defined as:

from . import views

or, maybe

from polls import views

it means that python cannot find the function index() in the views module.

Regards

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgUckZZtR%2BVBmW6ungOQ8uBowyE%2BSLG%3DVg%3DuqZVZmw275w%40mail.gmail.com.


Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-04-18 Thread Avi Mehenwal
I followed the same tutorial on 17th April 2021 with Python 3.9.2 and 
Django 3.2 and have exactly the same problems as mentioned above.

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

any help on how can I debug this? I am a django noob

On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:

> Thanks for your reploy.
>
> Actually I followed the tutorial exactly.
>
> My polls/views.py has:
>
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
>
> My polls/urls.py has:
>
> from django.conf.urls import url
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
>
>
> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>
>> You didn't give us enough info, but I am thinking that you don't have an 
>> index() function in your polls/views.py. Start the tutorial from the 
>> beginning and follow it closely.
>> On Apr 19, 2017 4:17 PM, Billy Lin  wrote:
>>
>> I'm following the getting started tutorial 01 and running into issues 
>> after creating the polls app. Can someone please help?
>>
>> I'm using Python 3.6.1 and Django 1.11.
>>
>> Here's the detailed trace:
>>
>> Performing system checks...
>> Unhandled exception in thread started by > check_errors..wrapper at 0x04222810>
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>>  
>> line
>> 227, in wrapper
>> fn(*args, **kwargs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
>> nserver.py", line 125, in inner_run
>> self.check(display_num_errors=True)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>  
>> l
>> ine 359, in check
>> include_deployment_checks=include_deployment_checks,
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>  
>> l
>> ine 346, in _run_checks
>> return checks.run_checks(**kwargs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>>  
>> l
>> ine 81, in run_checks
>> new_errors = check(app_configs=app_configs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>  
>> line
>> 16, in check_url_config
>> return check_resolver(resolver)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>  
>> line
>> 26, in check_resolver
>> return check_method()
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 25
>> 4, in check
>> for pattern in self.url_patterns:
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>  
>> line
>> 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 40
>> 5, in url_patterns
>> patterns = getattr(self.urlconf_module, "urlpatterns", 
>> self.urlconf_module)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>  
>> line
>> 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 39
>> 8, in urlconf_module
>> return import_module(self.urlconf_name)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>>  
>> line 126, in import_modu
>> le
>> return _bootstrap._gcd_import(name[l

Re: AttributeError: module 'polls.views' has no attribute 'index'

2017-04-19 Thread Billy Lin
Thanks for your reploy.

Actually I followed the tutorial exactly.

My polls/views.py has:

from django.http import HttpResponse


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

My polls/urls.py has:

from django.conf.urls import url

from . import views

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


On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:

> You didn't give us enough info, but I am thinking that you don't have an 
> index() function in your polls/views.py. Start the tutorial from the 
> beginning and follow it closely.
> On Apr 19, 2017 4:17 PM, Billy Lin > wrote:
>
> I'm following the getting started tutorial 01 and running into issues 
> after creating the polls app. Can someone please help?
>
> I'm using Python 3.6.1 and Django 1.11.
>
> Here's the detailed trace:
>
> Performing system checks...
> Unhandled exception in thread started by  check_errors..wrapper at 0x04222810>
> Traceback (most recent call last):
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>  
> line
> 227, in wrapper
> fn(*args, **kwargs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
> nserver.py", line 125, in inner_run
> self.check(display_num_errors=True)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>  
> l
> ine 359, in check
> include_deployment_checks=include_deployment_checks,
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>  
> l
> ine 346, in _run_checks
> return checks.run_checks(**kwargs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>  
> l
> ine 81, in run_checks
> new_errors = check(app_configs=app_configs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>  
> line
> 16, in check_url_config
> return check_resolver(resolver)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>  
> line
> 26, in check_resolver
> return check_method()
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 25
> 4, in check
> for pattern in self.url_patterns:
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>  
> line
> 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 40
> 5, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>  
> line
> 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 39
> 8, in urlconf_module
> return import_module(self.urlconf_name)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>  
> line 126, in import_modu
> le
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 978, in _gcd_import
>   File "", line 961, in _find_and_load
>   File "", line 950, in 
> _find_and_load_unlocked
>   File "", line 655, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 205, in 
> _call_with_frames_removed
>   File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, in 
> 
> url(r'^polls/', include('polls.urls')),
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py",
>  
> lin
> e 50, in include
> urlconf_module = import_module(urlconf_module)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>  

Re: AttributeError: module 'polls.views' has no attribute 'index'

2017-04-19 Thread m712 - Developer
You didn't give us enough info, but I am thinking that you don't have an index() function in your polls/views.py. Start the tutorial from the beginning and follow it closely.
On Apr 19, 2017 4:17 PM, Billy Lin  wrote:I'm following the getting started tutorial 01 and running into issues after creating the polls app. Can someone please help?I'm using Python 3.6.1 and Django 1.11.Here's the detailed trace:Performing system checks...Unhandled exception in thread started by .wrapper at 0x04222810>Traceback (most recent call last):  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line227, in wrapper    fn(*args, **kwargs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run    self.check(display_num_errors=True)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 359, in check    include_deployment_checks=include_deployment_checks,  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 346, in _run_checks    return checks.run_checks(**kwargs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks    new_errors = check(app_configs=app_configs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line16, in check_url_config    return check_resolver(resolver)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line26, in check_resolver    return check_method()  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 254, in check    for pattern in self.url_patterns:  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line35, in __get__    res = instance.__dict__[self.name] = self.func(instance)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line35, in __get__    res = instance.__dict__[self.name] = self.func(instance)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module    return import_module(self.urlconf_name)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "", line 978, in _gcd_import  File "", line 961, in _find_and_load  File "", line 950, in _find_and_load_unlocked  File "", line 655, in _load_unlocked  File "", line 678, in exec_module  File "", line 205, in _call_with_frames_removed  File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, in     url(r'^polls/', include('polls.urls')),  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py", line 50, in include    urlconf_module = import_module(urlconf_module)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "", line 978, in _gcd_import  File "", line 961, in _find_and_load  File "", line 950, in _find_and_load_unlocked  File "", line 655, in _load_unlocked  File "", line 678, in exec_module  File "", line 205, in _call_with_frames_removed  File "C:\Users\cephalin\Repos\django\mysite\polls\urls.py", line 6, in     url(r'^$', views.index, name='index'),AttributeError: module 'polls.views' has no attribute 'index'



-- 
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/b77a1a74-b07f-4277-98da-23b46ca7d2e4%40googlegroups.com.
For more op

AttributeError: module 'polls.views' has no attribute 'index'

2017-04-19 Thread Billy Lin
I'm following the getting started tutorial 01 and running into issues after 
creating the polls app. Can someone please help?

I'm using Python 3.6.1 and Django 1.11.

Here's the detailed trace:

Performing system checks...
Unhandled exception in thread started by .wrapper at 0x04222810>
Traceback (most recent call last):
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
 
line
227, in wrapper
fn(*args, **kwargs)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
nserver.py", line 125, in inner_run
self.check(display_num_errors=True)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
 
l
ine 359, in check
include_deployment_checks=include_deployment_checks,
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
 
l
ine 346, in _run_checks
return checks.run_checks(**kwargs)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
 
l
ine 81, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
 
line
16, in check_url_config
return check_resolver(resolver)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
 
line
26, in check_resolver
return check_method()
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 
line 25
4, in check
for pattern in self.url_patterns:
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
 
line
35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 
line 40
5, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
 
line
35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 
line 39
8, in urlconf_module
return import_module(self.urlconf_name)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
 
line 126, in import_modu
le
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 978, in _gcd_import
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 655, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 205, in 
_call_with_frames_removed
  File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, in 

url(r'^polls/', include('polls.urls')),
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py",
 
lin
e 50, in include
urlconf_module = import_module(urlconf_module)
  File 
"C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
 
line 126, in import_modu
le
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 978, in _gcd_import
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 655, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 205, in 
_call_with_frames_removed
  File "C:\Users\cephalin\Repos\django\mysite\polls\urls.py", line 6, in 

url(r'^$', views.index, name='index'),
AttributeError: module 'polls.views' has no attribute 'index'

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/b77a1a74-b07f-4277-98da-23b46ca7d2e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.