importError

24 views
Skip to first unread message

gkfk...@ajou.ac.kr

unread,
May 4, 2018, 9:13:08 AM5/4/18
to Django users
I run 'python manage.py runserver'.
but this message appear.

Traceback (most recent call last):
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\autoreload.py", l
ine 228, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\command
s\runserver.py", line 124, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\registry.py
", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py", l
ine 16, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py", l
ine 26, in check_resolver
    return check_method()
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py", lin
e 254, in check
    for pattern in self.url_patterns:
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py", l
ine 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py", lin
e 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py", l
ine 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py", lin
e 398, 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:\Users\gkfka\PycharmProjects\django\cafe\mysite\mysite\urls.py", line 17, in <module>
    from django.urls import include, path
ImportError: cannot import name include

Fidel Leon

unread,
May 4, 2018, 10:08:49 AM5/4/18
to django...@googlegroups.com
From the look of things, it seems:
-You're following the Django v2.0 tutorial.
-You have installed a Django v1 version.

This is an example with Django v2:

>>> import django 
>>> django.get_version()
'2.0.5'
>>> from django.urls import include, path
>>>
[No error]

And this is an example with Django v1.11

>>> from django import get_version
>>> get_version()        
'1.11.13'
>>> from django.urls import include, urls
Traceback (most recent call last):
 File "<console>", line 1, in <module>
ImportError: cannot import name 'include'
>>>

So either you upgrade your Django package, or you follow your Django version's tutorial :)


--
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/e9634a2e-8970-4f14-bb2b-1275ce305fad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages