#34189: Code in Tutorial does not work because of a ','
---------------------------------+--------------------------------------
     Reporter:  Roger Rüttimann  |                    Owner:  nobody
         Type:  Bug              |                   Status:  closed
    Component:  Documentation    |                  Version:  4.1
     Severity:  Normal           |               Resolution:  invalid
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by Roger Rüttimann):

 Thanks for the comment @Mariusz Felisiak, but even as the code might be
 valid python, I still think its a bug, because this happens when I copy
 paste the code of the tutorial and try to run the development server:


 {{{
 (cvmanager) ➜  cvmanager git:(main) ✗ python manage.py runserver
 Watching for file changes with StatReloader
 Performing system checks...

 Exception in thread django-main-thread:
 Traceback (most recent call last):
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/urls/resolvers.py", line 717, in url_patterns
     iter(patterns)
 TypeError: 'module' object is not iterable

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File
 
"/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py",
 line 1016, in _bootstrap_inner
     self.run()
   File
 
"/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py",
 line 953, in run
     self._target(*self._args, **self._kwargs)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/utils/autoreload.py", line 64, in wrapper
     fn(*args, **kwargs)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/management/commands/runserver.py", line 134, in
 inner_run
     self.check(display_num_errors=True)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/management/base.py", line 475, in check
     all_issues = checks.run_checks(
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/checks/registry.py", line 88, in run_checks
     new_errors = check(app_configs=app_configs, databases=databases)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/checks/urls.py", line 14, in check_url_config
     return check_resolver(resolver)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/checks/urls.py", line 24, in check_resolver
     return check_method()
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/urls/resolvers.py", line 495, in check
     messages.extend(check_resolver(pattern))
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/core/checks/urls.py", line 24, in check_resolver
     return check_method()
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/urls/resolvers.py", line 494, in check
     for pattern in self.url_patterns:
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/utils/functional.py", line 57, in __get__
     res = instance.__dict__[self.name] = self.func(instance)
   File "/Users/rroger/py_virtualenvs/cvmanager/lib/python3.10/site-
 packages/django/urls/resolvers.py", line 725, in url_patterns
     raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
 django.core.exceptions.ImproperlyConfigured: The included URLconf '<module
 'cv.urls' from '/Users/rroger/workspace/cvmanager/cv/urls.py'>' does not
 appear to have any patterns in it. If you see the 'urlpatterns' variable
 with valid patterns in the file then the issue is probably caused by a
 circular import.
 }}}

 and without the ',' it works as expected. I think code in a tutorial
 should run without raisng exceptions.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34189#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184c377032f-992b3ead-c8df-4a91-ba7e-8fe4fbc9fbb8-000000%40eu-central-1.amazonses.com.

Reply via email to