Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : cannot import name 'patterns' ; How to solve it ? #2

Open
connect2robiul opened this issue Mar 21, 2017 · 2 comments
Open

Error : cannot import name 'patterns' ; How to solve it ? #2

connect2robiul opened this issue Mar 21, 2017 · 2 comments

Comments

@connect2robiul
Copy link

Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 342, in execute self.check() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks issues.extend(super(Command, self)._run_checks(**kwargs)) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/Users/robiulislam/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/robiulislam/personal/personal/urls.py", line 15, in <module> url(r'^polls/$', 'personal.views.polls'), File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/conf/urls/__init__.py", line 85, in url raise TypeError('view must be a callable or a list/tuple in the case of include().') TypeError: view must be a callable or a list/tuple in the case of include(). ROBIULs-MacBook-Pro:personal robiulislam$ cd ./hone -bash: cd: ./hone: No such file or directory ROBIULs-MacBook-Pro:personal robiulislam$ cd /home ROBIULs-MacBook-Pro:home robiulislam$ cd helloworld-master -bash: cd: helloworld-master: No such file or directory ROBIULs-MacBook-Pro:home robiulislam$ ls ROBIULs-MacBook-Pro:home robiulislam$ cd /Users/robiulislam/helloworld-master ROBIULs-MacBook-Pro:helloworld-master robiulislam$ python manage.py migrate \Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 342, in execute self.check() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks issues.extend(super(Command, self)._run_checks(**kwargs)) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/Users/robiulislam/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/robiulislam/helloworld-master/helloworld/urls.py", line 3, in <module> from django.conf.urls import patterns, include ImportError: cannot import name 'patterns'

@changlinzhang
Copy link

@connect2robiul
Hi, I am also a user of this repo and met the same problem.
Have you found out how to solve it?

@gusbemacbe
Copy link

@connect2robiul and @changlinzhang

This case of patterns and (r' ', include()) has been depreciated and the versions 1.8 and 1.9 are no longer considered as secure and you have to upgrade to 2. See the case:

  1. https://stackoverflow.com/questions/8074955/cannot-import-name-patterns
  2. https://docs.djangoproject.com/en/2.0/topics/http/urls/#example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants