I got error when working on "Writing your first Django app, part 5" of tutorial

68 views
Skip to first unread message

truongtronghai

unread,
May 4, 2018, 1:13:08 PM5/4/18
to Django users
When I run below command
>>>
response = client.get('/')
I got error "module 'django.conf.global_settings' has no attribute 'ROOT_URLCONF'"

Please give me advice to solve it. Thanks

brzrkr

unread,
May 4, 2018, 4:51:16 PM5/4/18
to Django users
It seems you need to point your Django project to your urls.py file. See: https://docs.djangoproject.com/en/2.0/ref/settings/#root-urlconf
This should point to your urls.py file, the file containing the `urlpatterns` variable, which is a list of `path()` statements.
For example if your urls.py file is in `/myapp/urls.py`, in your settings.py you should write: `ROOT_URLCONF = myapp.urls`.

Anthony Flury

unread,
May 5, 2018, 10:36:52 PM5/5/18
to django...@googlegroups.com
ROOT_URLCONF ideally point to the top level project urls.py if you have
one - if you point it to an app's urls.py - you have to them make sure
you link that app back to all the other (which sort of defeats the point
of the app) - and make sure that something you refers forward to the
admin urls.

It is better to point it too the top level urls.py.

'django-admin startproject blah' builds a default : ROOT_URL_CONF =
'blah.urls' which should be sufficient unless you are doing something odd.
> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto: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/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
--
Anthony Flury
email : *Anthon...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

Reply all
Reply to author
Forward
0 new messages