dimanche 25 février 2018

Page not found 404 URL config

I keep getting the following error in my terminal (while running server) when I try to look at the home page. "GET / HTTP/1.1" 404 2028

here is the code that I have for mapping URLS:

urls.py (main):

   from django.urls import path
from django.contrib import admin
from django.urls import include


urlpatterns = [
    path('admin/', admin.site.urls),
    path(r' ', include('learning_logs.urls', namespace='learning_logs')),
]

urls.py(in learning_logs folder)

    """Define URL pattersn for learning_logs."""

from django.conf.urls import url
from . import views

app_name = 'learning_logs'

urlpatterns = [
    # Home page
    url(r'^$', views.index, name='index'),
]

views.py:

   from django.shortcuts import render


def index(request):
    """The home page for learning log"""
    return render(request, 'learning_logs/index.html')
# Create your views here.

index.html:

    <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <p>Learning Log</p>
    <p>Learning log helps you keep track of your learning, for any topic you're learning about.</p>
  </body>
</html>

this is the error I'm getting on the home page:

Using the URLconf defined in learning_log.urls, Django tried these URL patterns, in this order: admin/

Thanks for the help in advance.

Aucun commentaire:

Enregistrer un commentaire