setting up urls of many apps

169 views
Skip to first unread message

Peter Kirieny

unread,
Feb 17, 2021, 1:31:50 AM2/17/21
to django...@googlegroups.com
someone to help me to set up urls of two different apps in django project please, i keep on getting errors
am new

Peter Kirieny

unread,
Feb 17, 2021, 3:32:35 AM2/17/21
to django...@googlegroups.com

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\management\base.py", line 392, in check
    all_issues = checks.run_checks(
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\urls\resolvers.py", line 409, in check
    messages.extend(check_resolver(pattern))
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\urls\resolvers.py", line 409, in check
    messages.extend(check_resolver(pattern))
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\urls\resolvers.py", line 335, in check
    warnings = self._check_pattern_name()
  File "C:\Users\Admin\PycharmProject\Ecomm\venv\lib\site-packages\django\urls\resolvers.py", line 343, in _check_pattern_name
    if self.pattern.name is not None and ":" in self.pattern.name:
TypeError: argument of type 'type' is not iterable

Nicolas nasr

unread,
Feb 17, 2021, 9:53:25 AM2/17/21
to Django users
Can  you please show your urls.py file

Peter Kirieny

unread,
Feb 18, 2021, 1:27:03 AM2/18/21
to django...@googlegroups.com
in the projects urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('allauth.urls')),
path('', include('core.urls', namespace='core')),
path('Shops/', include('Shops.urls', namespace='core')),

]

if settings.DEBUG:
import debug_toolbar
urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)

in the app's urls.py

from django.urls import path
from .views import ShopsView

app_name = 'Shops'

urlpatterns = [
path('Shops/', ShopsView.as_view(), name=ShopsView)

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/635506c8-35bc-4c76-a937-c992dd1312dbn%40googlegroups.com.

RANGA BHARATH JINKA

unread,
Feb 18, 2021, 1:33:40 AM2/18/21
to django...@googlegroups.com
Hi, 

Please check namespace='core' in project urls.py. For shops app also namespace is same. Please change this namesapce to Shops.

All the best



--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

Peter Kirieny

unread,
Feb 18, 2021, 1:40:25 AM2/18/21
to django...@googlegroups.com
thanks sir
that's done though the error still persists

Peter Kirieny

unread,
Feb 18, 2021, 1:42:51 AM2/18/21
to django...@googlegroups.com
    if self.pattern.name is not None and ":" in self.pattern.name:
TypeError: argument of type 'type' is not iterable

that's the error

RANGA BHARATH JINKA

unread,
Feb 18, 2021, 2:00:44 AM2/18/21
to django...@googlegroups.com

Jorge Gimeno

unread,
Feb 20, 2021, 12:33:59 PM2/20/21
to django...@googlegroups.com
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m31747wx_k4vRq0SW8LH75KSLE-JVffQ_Rr4MjqjQjd_8rw%40mail.gmail.com.

The issue appears to be in your apps urls.py.  The 'name' parameter is expected to be a string, and you're passing a view object.

-Jorge

Peter Kirieny

unread,
Feb 22, 2021, 2:35:34 AM2/22/21
to django...@googlegroups.com
Thanks Jorge
it was of great help


Reply all
Reply to author
Forward
0 new messages