Friday, May 4, 2018

Re: importError

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 :)


El vie., 4 may. 2018 a las 15:12, <gkfka5968@ajou.ac.kr> escribió:
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

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


--
Fidel Leon
Phone: +34 622 26 44 92

--
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/CAHXg%3DN1JFHZBryqHtMM0DbBf5Q9XyG6h%2BAJmFAmH7UbWU8jPjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment