Python Forum

Full Version: Page not found (404) - Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I started a project Learning_log. All going well till I started making pages.

It was opening alright in django.
------------------
In urls.py (following changes: include in 2nd line and path in 5th. line)

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

urlpatterns = [
path('admin/', admin.site.urls),
path(' ', include('learning_logs.urls')),
]
---------------
IN learning_log folder, new urls.py file:

"""Defines URL patterns for learning_logs."""

from django.urls import path

from . import views

app_name = 'learning_logs'
urlpatterns = [
# Home Page
path(' ', views.index, name='index'),
]
---------------
In views.py :

from django.shortcuts import render

# Create your views here.
def index(request):
	"""The home page for Learning Log."""
	return render(request, 'learning_logs/index.html')
---------------
Then in project folder learning_log, made new folder inside learning_logs called templates. Inside templates a learning_logs folder and finally a index.html page with following:

Output:
<p>Learning Log</p> <p> Learning Log helps you to keep track of your learning,for any topic you're learning about. </p>
---------------

It shows Page not found 404 error.....What to do ???
Anyone can advice...??