为了账号安全,请及时绑定邮箱和手机立即绑定

Cannot find reference"index"in '__init__'找不到index

http://img1.sycdn.imooc.com//59434d710001c4b212730754.jpg

就打不开hello world的网页了。

正在回答

2 回答

已经找到问题了,路径上写错了。

0 回复 有任何疑惑可以回复我~

C:\imooc\myblog>python manage.py runserver

Performing system checks...


Unhandled exception in thread started by <function check_errors.<locals>.wrapper

 at 0x000000000433CE18>

Traceback (most recent call last):

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\autoreload.py", line 226, in wrapper

    fn(*args, **kwargs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\commands\runserver.py", line 121, in inner_run

    self.check(display_num_errors=True)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\base.py", line 374, in check

    include_deployment_checks=include_deployment_checks,

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\base.py", line 361, in _run_checks

    return checks.run_checks(**kwargs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\registry.py", line 81, in run_checks

    new_errors = check(app_configs=app_configs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\urls.py", line 14, in check_url_config

    return check_resolver(resolver)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\urls.py", line 24, in check_resolver

    for pattern in resolver.url_patterns:

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\urls\resolvers.py", line 313, in url_patterns

    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\urls\resolvers.py", line 306, in urlconf_module

    return import_module(self.urlconf_name)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\importlib\__in

it__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 986, in _gcd_import

  File "<frozen importlib._bootstrap>", line 969, in _find_and_load

  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 665, in exec_module

  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed

  File "C:\imooc\myblog\myblog\urls.py", line 22, in <module>

    url(r'^index/', bv.index),

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

Performing system checks...


Unhandled exception in thread started by <function check_errors.<locals>.wrapper

 at 0x000000000433CE18>

Traceback (most recent call last):

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\autoreload.py", line 226, in wrapper

    fn(*args, **kwargs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\commands\runserver.py", line 121, in inner_run

    self.check(display_num_errors=True)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\base.py", line 374, in check

    include_deployment_checks=include_deployment_checks,

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\management\base.py", line 361, in _run_checks

    return checks.run_checks(**kwargs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\registry.py", line 81, in run_checks

    new_errors = check(app_configs=app_configs)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\urls.py", line 14, in check_url_config

    return check_resolver(resolver)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\core\checks\urls.py", line 24, in check_resolver

    for pattern in resolver.url_patterns:

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\urls\resolvers.py", line 313, in url_patterns

    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\site-packages\

django\urls\resolvers.py", line 306, in urlconf_module

    return import_module(self.urlconf_name)

  File "C:\Users\yilan\AppData\Local\Programs\Python\Python35\lib\importlib\__in

it__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 986, in _gcd_import

  File "<frozen importlib._bootstrap>", line 969, in _find_and_load

  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 665, in exec_module

  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed

  File "C:\imooc\myblog\myblog\urls.py", line 23, in <module>

    url(r'^index/', bv.index),

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


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
django入门与实践
  • 参与学习       65159    人
  • 解答问题       869    个

手把手带你进入Django开发的大门,充分领略Django的魅力

进入课程

Cannot find reference"index"in '__init__'找不到index

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信