ReRed
ReRed

Reputation: 373

DJango mysite/urls.py not including correctly

I am currently trying to write my first DJango following this tutorial: https://docs.djangoproject.com/en/3.2/intro/tutorial01/

I ran into an issue where I get a page not found at /.

My mysite/urls.py is the following:

urlpatterns = [
    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),
]

And polls.urls.py:

urlpatterns = [
    path('', views.index, name='index'),
]

However, if I change this in settings.py

ROOT_URLCONF = 'mysite.urls'

to

ROOT_URLCONF = 'polls.urls'

It works. What am I doing wrong, I am literally following the tutorial.

Upvotes: 0

Views: 126

Answers (1)

Reshab Das
Reshab Das

Reputation: 170

Use ROOT_URLCONF = 'mysite.urls' and in mysite.urls.py use path('', include('polls.urls'))

Upvotes: 1

Related Questions