JungDev / django-telegrambot

Simple app for Telegram bot in Django
BSD 3-Clause "New" or "Revised" License
237 stars 88 forks source link

ImportError: cannot import name patterns on django_telegrambot\urls.py #1

Closed fedaykin-b closed 7 years ago

fedaykin-b commented 7 years ago

I ran this after following the instructions:

(my project)\>py -2 manage.py check

and

(my project)\>py -3 manage.py check

And both got this error:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Python27\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Python27\lib\site-packages\django\core\management\base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "D:\Python27\lib\site-packages\django\core\management\commands\check.py", line 68, in handle
    fail_level=getattr(checks, options['fail_level']),
  File "D:\Python27\lib\site-packages\django\core\management\base.py", line 374, in check
    include_deployment_checks=include_deployment_checks,
  File "D:\Python27\lib\site-packages\django\core\management\base.py", line 361, in _run_checks
    return checks.run_checks(**kwargs)
  File "D:\Python27\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\Python27\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "D:\Python27\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
    for pattern in resolver.url_patterns:
  File "D:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python27\lib\site-packages\django\urls\resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python27\lib\site-packages\django\urls\resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "D:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "(my project)\urls.py", line 23, in <module>
    url(r'^t/', include('django_telegrambot.urls')),
  File "D:\Python27\lib\site-packages\django\conf\urls\__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "D:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "D:\Python27\lib\site-packages\django_telegrambot\urls.py", line 2, in <module>
    from django.conf.urls import url, include, patterns
ImportError: cannot import name patterns

on Windows 10 Pro x64 Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)]

JungDev commented 7 years ago

django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.

JungDev commented 7 years ago

Fixed in version 0.2.4 To update: pip install django-telegrambot --upgrade