Must be my and and can't be my code -- tracing back a URL pattern type mismatch

29 views
Skip to first unread message

Josh Marshall

unread,
Mar 30, 2019, 10:31:42 PM3/30/19
to Django users
I'm helping out on a project, but am running into a paradox of a bug must existing in the code, but no project code is called.  Not sure how to deal with this one.  It looks related to URL setup and the urls.py file is practically identical to the examples.  Can anyone make sense of this stack trace?


```
[anadon@goodadvicemallard project1]$ poetry run ./manage.py check
/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Auto generated 7 views for endpoints
Traceback (most recent call last):
  File "./manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/commands/check.py", line 65, in handle
    fail_level=getattr(checks, options['fail_level']),
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py", line 379, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py", line 366, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/registry.py", line 71, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 397, in check
    warnings.extend(check_resolver(pattern))
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 397, in check
    warnings.extend(check_resolver(pattern))
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 397, in check
    warnings.extend(check_resolver(pattern))
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in check
    return warnings or self.pattern.check()
AttributeError: 'str' object has no attribute 'check'

```

Jorge Gimeno

unread,
Mar 31, 2019, 12:42:17 AM3/31/19
to django...@googlegroups.com
--
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/af68afca-05c2-4241-a089-835387b4217b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Try running this with:

poetry run python ./manage.py check

-Jorge

Josh Marshall

unread,
Mar 31, 2019, 11:04:15 AM3/31/19
to Django users
Identical behavior.

On Sunday, March 31, 2019 at 12:42:17 AM UTC-4, jlgimeno71 wrote:

To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

nm

unread,
Apr 1, 2019, 9:19:01 AM4/1/19
to Django users
Do you use any additional packages like e.g. Django Debug Toolbar? Or anything else that could mess with your urls? This is just a wild guess, but since nobody has answered with a better idea yet...

Josh Marshall

unread,
Apr 1, 2019, 9:51:18 AM4/1/19
to django...@googlegroups.com
I do in fact use Django Debug Toolbar.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ACLGAT0lUGQ/unsubscribe.
To unsubscribe from this group and all its topics, 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.

nm

unread,
Apr 1, 2019, 10:57:19 AM4/1/19
to Django users
Then I'd suggest you try commenting out the relevant settings and urls (urlpatterns = [path('__debug__/', include(debug_toolbar.urls)),] or whatever you have there), and see what happens when you run `./manage.py check`.

I once had a url-related problem that only appeared when I ran tests; it would disappear when I disabled the toolbar. Mine was a different one, but I thought maybe your error has something to do with the toolbar, since you said it certainly wasn't the app's code.

On Monday, 1 April 2019 15:51:18 UTC+2, Josh Marshall wrote:
I do in fact use Django Debug Toolbar.

To unsubscribe from this group and all its topics, send an email to django...@googlegroups.com.

Josh Marshall

unread,
Apr 3, 2019, 11:07:47 PM4/3/19
to Django users
OK, I've gotten time to touch the code again, applied your suggestion, but there is no apparent change in behavior.  For the sake of argument, I'm including the stack trace again.  I'm not sure where my good debugging entry point is here.
stack trace
Reply all
Reply to author
Forward
0 new messages