python - Django, tutorial - error: No module named urls -


hi following tutorial make first web app django(link) given error:

 file "c:\python27\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper     fn(*args, **kwargs)    file "c:\python27\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run     self.check(display_num_errors=true)    file "c:\python27\lib\site-packages\django\core\management\base.py", line 374, in check     include_deployment_checks=include_deployment_checks,    file "c:\python27\lib\site-packages\django\core\management\base.py", line 361, in _run_checks     return checks.run_checks(**kwargs)    file "c:\python27\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks     new_errors = check(app_configs=app_configs)    file "c:\python27\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config     return check_resolver(resolver)    file "c:\python27\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver     pattern in resolver.url_patterns:    file "c:\python27\lib\site-packages\django\utils\functional.py", line 35, in __get__     res = instance.__dict__[self.name] = self.func(instance)    file "c:\python27\lib\site-packages\django\urls\resolvers.py", line 313, in url_patterns     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)    file "c:\python27\lib\site-packages\django\utils\functional.py", line 35, in __get__     res = instance.__dict__[self.name] = self.func(instance)    file "c:\python27\lib\site-packages\django\urls\resolvers.py", line 306, in urlconf_module     return import_module(self.urlconf_name)    file "c:\python27\lib\importlib\__init__.py", line 37, in import_module     __import__(name)    file "c:\python27\proj\mysite\mysite\urls.py", line 7, in <module>     url(r'^polls/', include('polls.urls'))    file "c:\python27\lib\site-packages\django\conf\urls\__init__.py", line 50, in include     urlconf_module = import_module(urlconf_module)    file "c:\python27\lib\importlib\__init__.py", line 37, in import_module     __import__(name) importerror: no module named urls 

i have read answers here on so, suggest error caused wrong version of framework, not case. version of python 2.7 , djanog 1.10.1

my urls.py

from django.conf.urls import url, include   django.contrib import admin  urlpatterns = [     url(r'^polls/', include('polls.urls'))    ] 

thank you.

edit:

file: polls/urls.py

from django.conf.urls import url  . import views  urlpatterns = [     url(r'^$', views.index, name='index'), ] 

edit 2:

thank comments. there file structure of project.

enter image description here

url(r'^polls/', include('polls.urls'))

what line doing it's adding urls.py of polls app folder, urls , appending polls/ in front of all.

coming error :

file "c:\python27\proj\mysite\mysite\urls.py", line 7, in <module>     url(r'^polls/', include('polls.urls')) 

the error says it's not able find urls.py in polls folder, make sure it's there. , configured well.

and make sure following :

  • your app polls listed in installed_apps of settings.py
  • confirm there __init__.py file in polls app folder

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -